mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 14:37:36 +02:00
refactor: only update sync status columns when syncing push mirror (#39517)
`UpdatePushMirror` used `AllCols()`, so a sync could overwrite columns changed concurrently (e.g. `interval`) with stale values. It now updates only `last_update` and `last_error`, and is renamed to `UpdatePushMirrorSyncStatus` to match. Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 5) <noreply@anthropic.com>
This commit is contained in:
3 files changed
+8
-6
No files matched your search
@@ -55,6 +55,7 @@ func testMirrorPush(t *testing.T, u *url.URL) {
|
||||
|
||||
ok := mirror_service.SyncPushMirror(t.Context(), mirrors[0].ID)
|
||||
assert.True(t, ok)
|
||||
assert.NotZero(t, unittest.AssertExistsAndLoadBean(t, &repo_model.PushMirror{ID: mirrors[0].ID}).LastUpdateUnix)
|
||||
|
||||
srcGitRepo, err := git.OpenRepository(t.Context(), srcRepo)
|
||||
assert.NoError(t, err)
|
||||
@@ -74,6 +75,7 @@ func testMirrorPush(t *testing.T, u *url.URL) {
|
||||
|
||||
defer test.MockVariableValue(&setting.Migrations.AllowedHostList, "")()
|
||||
assert.False(t, mirror_service.SyncPushMirror(t.Context(), mirrors[0].ID))
|
||||
assert.NotEmpty(t, unittest.AssertExistsAndLoadBean(t, &repo_model.PushMirror{ID: mirrors[0].ID}).LastError)
|
||||
|
||||
// Cleanup
|
||||
assert.True(t, doRemovePushMirror(t, session, user.Name, srcRepo.Name, mirrors[0].ID))
|
||||
|
||||
Reference in new issue
Block a user