diff options
author | JakobDev <jakobdev@gmx.de> | 2024-01-24 03:32:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 02:32:57 +0000 |
commit | f3ba3e922dde7d12999a90d6cee15805a56cc7ff (patch) | |
tree | 1c61b2cf05fa7fb067627ba4544b3e19fb4ebc07 /models | |
parent | 1af45689f9bdac7267400a8c9d77c23676b33935 (diff) | |
download | gitea-f3ba3e922dde7d12999a90d6cee15805a56cc7ff.tar.gz gitea-f3ba3e922dde7d12999a90d6cee15805a56cc7ff.zip |
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.
Diffstat (limited to 'models')
-rw-r--r-- | models/repo/pushmirror.go | 7 |
1 files changed, 5 insertions, 2 deletions
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) |