|
|
@ -129,10 +129,12 @@ func GetPushMirrorsSyncedOnCommit(repoID int64) ([]*PushMirror, error) { |
|
|
|
|
|
|
|
|
|
|
|
// PushMirrorsIterate iterates all push-mirror repositories.
|
|
|
|
// PushMirrorsIterate iterates all push-mirror repositories.
|
|
|
|
func PushMirrorsIterate(ctx context.Context, limit int, f func(idx int, bean interface{}) error) error { |
|
|
|
func PushMirrorsIterate(ctx context.Context, limit int, f func(idx int, bean interface{}) error) error { |
|
|
|
return db.GetEngine(ctx). |
|
|
|
sess := db.GetEngine(ctx). |
|
|
|
Where("last_update + (`interval` / ?) <= ?", time.Second, time.Now().Unix()). |
|
|
|
Where("last_update + (`interval` / ?) <= ?", time.Second, time.Now().Unix()). |
|
|
|
And("`interval` != 0"). |
|
|
|
And("`interval` != 0"). |
|
|
|
OrderBy("last_update ASC"). |
|
|
|
OrderBy("last_update ASC") |
|
|
|
Limit(limit). |
|
|
|
if limit > 0 { |
|
|
|
Iterate(new(PushMirror), f) |
|
|
|
sess = sess.Limit(limit) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return sess.Iterate(new(PushMirror), f) |
|
|
|
} |
|
|
|
} |
|
|
|