Skip to content

Commit 603b1b8

Browse files
authored
Merge branch 'main' into stop-repo-indexer-test-instability-2
2 parents e528fdb + d2ca021 commit 603b1b8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

models/repo/mirror.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package repo
77

88
import (
9+
"context"
910
"errors"
1011
"fmt"
1112
"time"
@@ -113,6 +114,13 @@ func UpdateMirror(m *Mirror) error {
113114
return updateMirror(db.GetEngine(db.DefaultContext), m)
114115
}
115116

117+
// TouchMirror updates the mirror updatedUnix
118+
func TouchMirror(ctx context.Context, m *Mirror) error {
119+
m.UpdatedUnix = timeutil.TimeStampNow()
120+
_, err := db.GetEngine(ctx).ID(m.ID).Cols("updated_unix").Update(m)
121+
return err
122+
}
123+
116124
// DeleteMirrorByRepoID deletes a mirror by repoID
117125
func DeleteMirrorByRepoID(repoID int64) error {
118126
_, err := db.GetEngine(db.DefaultContext).Delete(&Mirror{RepoID: repoID})

services/mirror/mirror_pull.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ func SyncPullMirror(ctx context.Context, repoID int64) bool {
411411
log.Trace("SyncMirrors [repo: %-v]: Running Sync", m.Repo)
412412
results, ok := runSync(ctx, m)
413413
if !ok {
414+
if err = repo_model.TouchMirror(ctx, m); err != nil {
415+
log.Error("SyncMirrors [repo: %-v]: failed to TouchMirror: %v", m.Repo, err)
416+
}
414417
return false
415418
}
416419

0 commit comments

Comments
 (0)