mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-05 12:29:05 +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
@@ -78,13 +78,13 @@ func (m *PushMirror) GetRemoteName() string {
|
||||
return m.RemoteName
|
||||
}
|
||||
|
||||
// UpdatePushMirror updates the push-mirror
|
||||
func UpdatePushMirror(ctx context.Context, m *PushMirror) error {
|
||||
_, err := db.GetEngine(ctx).ID(m.ID).AllCols().Update(m)
|
||||
// UpdatePushMirrorSyncStatus updates the sync status (last update time and last error) of the push-mirror
|
||||
func UpdatePushMirrorSyncStatus(ctx context.Context, m *PushMirror) error {
|
||||
_, err := db.GetEngine(ctx).ID(m.ID).Cols("last_update", "last_error").Update(m)
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePushMirrorInterval updates the push-mirror
|
||||
// UpdatePushMirrorInterval updates the sync interval of the push-mirror
|
||||
func UpdatePushMirrorInterval(ctx context.Context, m *PushMirror) error {
|
||||
_, err := db.GetEngine(ctx).ID(m.ID).Cols("interval").Update(m)
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user