forked from Silverfish/proton-bridge
fix(GODT-2327): Don't retry with abortable context because it's canceled
This commit is contained in:
@ -140,7 +140,7 @@ func (bridge *Bridge) addIMAPUser(ctx context.Context, user *user.User) error {
|
|||||||
if err := user.ClearSyncStatus(); err != nil {
|
if err := user.ClearSyncStatus(); err != nil {
|
||||||
return fmt.Errorf("failed to clear sync status: %w", err)
|
return fmt.Errorf("failed to clear sync status: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the user back to the IMAP server.
|
// Add the user back to the IMAP server.
|
||||||
if isNew, err := bridge.imapServer.LoadUser(ctx, imapConn, gluonID, user.GluonKey()); err != nil {
|
if isNew, err := bridge.imapServer.LoadUser(ctx, imapConn, gluonID, user.GluonKey()); err != nil {
|
||||||
return fmt.Errorf("failed to add IMAP user: %w", err)
|
return fmt.Errorf("failed to add IMAP user: %w", err)
|
||||||
|
|||||||
@ -196,15 +196,7 @@ func New(
|
|||||||
|
|
||||||
if err := user.doSync(ctx); err != nil {
|
if err := user.doSync(ctx); err != nil {
|
||||||
user.log.WithError(err).Error("Failed to sync, will retry later")
|
user.log.WithError(err).Error("Failed to sync, will retry later")
|
||||||
|
time.AfterFunc(SyncRetryCooldown, user.goSync)
|
||||||
go func() {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
user.log.WithError(err).Warn("Aborting sync retry")
|
|
||||||
case <-time.After(SyncRetryCooldown):
|
|
||||||
user.goSync()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user