From f3ba3e922dde7d12999a90d6cee15805a56cc7ff Mon Sep 17 00:00:00 2001 From: JakobDev Date: Wed, 24 Jan 2024 03:32:57 +0100 Subject: Don't run push mirrors for archived repos (#27140) Fixes https://codeberg.org/forgejo/forgejo/issues/612 At the moment push mirrors are still run if a repo is archived. This PR fixes this. --- models/repo/pushmirror.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'models') diff --git a/models/repo/pushmirror.go b/models/repo/pushmirror.go index 24c58faf84..bf134abfb1 100644 --- a/models/repo/pushmirror.go +++ b/models/repo/pushmirror.go @@ -121,8 +121,11 @@ func GetPushMirrorsSyncedOnCommit(ctx context.Context, repoID int64) ([]*PushMir // PushMirrorsIterate iterates all push-mirror repositories. func PushMirrorsIterate(ctx context.Context, limit int, f func(idx int, bean any) error) error { sess := db.GetEngine(ctx). - Where("last_update + (`interval` / ?) <= ?", time.Second, time.Now().Unix()). - And("`interval` != 0"). + Table("push_mirror"). + Join("INNER", "`repository`", "`repository`.id = `push_mirror`.repo_id"). + Where("`push_mirror`.last_update + (`push_mirror`.`interval` / ?) <= ?", time.Second, time.Now().Unix()). + And("`push_mirror`.`interval` != 0"). + And("`repository`.is_archived = ?", false). OrderBy("last_update ASC") if limit > 0 { sess = sess.Limit(limit) -- cgit v1.2.3