Merge pull request #7036 from swordqiu/hotfix/qj-cloud-account-sync-sync

fix: cloud account sync may block
This commit is contained in:
Zexi Li
2020-07-04 10:39:22 +08:00
committed by GitHub
+3 -1
View File
@@ -2368,6 +2368,7 @@ func (account *SCloudaccount) SubmitSyncAccountTask(ctx context.Context, userCre
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")
}
return
@@ -2386,8 +2387,9 @@ func (account *SCloudaccount) SubmitSyncAccountTask(ctx context.Context, userCre
if waitChan != nil {
if err != nil {
account.markEndSync(userCred)
err = errors.Wrap(err, "account.syncAccountStatus")
}
waitChan <- errors.Wrap(err, "account.syncAccountStatus")
waitChan <- err
} else {
syncCnt := 0
if err == nil && autoSync && account.GetEnabled() && account.EnableAutoSync {