aboutsummaryrefslogtreecommitdiffstats
path: root/services/cron/tasks_basic.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/cron/tasks_basic.go')
-rw-r--r--services/cron/tasks_basic.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/services/cron/tasks_basic.go b/services/cron/tasks_basic.go
index 57fb399d4e..219173ccf0 100644
--- a/services/cron/tasks_basic.go
+++ b/services/cron/tasks_basic.go
@@ -18,13 +18,24 @@ import (
)
func registerUpdateMirrorTask() {
- RegisterTaskFatal("update_mirrors", &BaseConfig{
- Enabled: true,
- RunAtStart: false,
- Schedule: "@every 10m",
- NoSuccessNotice: true,
- }, func(ctx context.Context, _ *models.User, _ Config) error {
- return mirror_service.Update(ctx)
+ type UpdateMirrorTaskConfig struct {
+ BaseConfig
+ PullLimit int
+ PushLimit int
+ }
+
+ RegisterTaskFatal("update_mirrors", &UpdateMirrorTaskConfig{
+ BaseConfig: BaseConfig{
+ Enabled: true,
+ RunAtStart: false,
+ Schedule: "@every 10m",
+ NoSuccessNotice: true,
+ },
+ PullLimit: 50,
+ PushLimit: 50,
+ }, func(ctx context.Context, _ *models.User, cfg Config) error {
+ umtc := cfg.(*UpdateMirrorTaskConfig)
+ return mirror_service.Update(ctx, umtc.PullLimit, umtc.PushLimit)
})
}