From 41b8579fc5962b776f0950b359f002687da68ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Thu, 26 Dec 2024 09:46:55 +0800 Subject: [PATCH] fix(region): skip record conflict error (#21900) --- pkg/compute/tasks/cloud_account_sync_task.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/compute/tasks/cloud_account_sync_task.go b/pkg/compute/tasks/cloud_account_sync_task.go index d33417c0bb..68e5f62699 100644 --- a/pkg/compute/tasks/cloud_account_sync_task.go +++ b/pkg/compute/tasks/cloud_account_sync_task.go @@ -16,6 +16,7 @@ package tasks import ( "context" + "strings" "yunion.io/x/jsonutils" "yunion.io/x/log" @@ -80,9 +81,11 @@ func (self *CloudAccountSyncInfoTask) OnInit(ctx context.Context, obj db.IStanda func (self *CloudAccountSyncInfoTask) OnCloudaccountSyncReadyFailed(ctx context.Context, obj db.IStandaloneModel, err jsonutils.JSONObject) { cloudaccount := obj.(*models.SCloudaccount) - db.OpsLog.LogEvent(cloudaccount, db.ACT_SYNC_HOST_FAILED, err, self.UserCred) + if !strings.Contains(err.String(), "ConflictError") { + db.OpsLog.LogEvent(cloudaccount, db.ACT_SYNC_HOST_FAILED, err, self.UserCred) + logclient.AddActionLogWithStartable(self, cloudaccount, logclient.ACT_CLOUD_SYNC, err, self.UserCred, false) + } self.SetStageFailed(ctx, err) - logclient.AddActionLogWithStartable(self, cloudaccount, logclient.ACT_CLOUD_SYNC, err, self.UserCred, false) } func (self *CloudAccountSyncInfoTask) OnCloudaccountSyncReady(ctx context.Context, obj db.IStandaloneModel, body jsonutils.JSONObject) {