Merge pull request #7405 from ioito/hotfix/qx-account-sync-deadlock

fix: avoid account sync deadlock
This commit is contained in:
Zexi Li
2020-07-31 18:05:17 +08:00
committed by GitHub
+5 -3
View File
@@ -2380,9 +2380,11 @@ func (account *SCloudaccount) SubmitSyncAccountTask(ctx context.Context, userCre
defer cloudaccountPendingSyncsMutex.Unlock()
if _, ok := cloudaccountPendingSyncs[account.Id]; ok {
if waitChan != nil {
// an active cloudaccount sync task is running, return with conflict error
log.Errorf("an active cloudaccount sync task is running, early return with conflict error")
waitChan <- errors.Wrap(httperrors.ErrConflict, "cloudaccountPendingSyncs")
go func() {
// an active cloudaccount sync task is running, return with conflict error
log.Errorf("an active cloudaccount sync task is running, early return with conflict error")
waitChan <- errors.Wrap(httperrors.ErrConflict, "cloudaccountPendingSyncs")
}()
}
return
}