diff --git a/internal/pkg/config/config.example.yaml b/internal/pkg/config/config.example.yaml index 2176dff7..efa6510b 100644 --- a/internal/pkg/config/config.example.yaml +++ b/internal/pkg/config/config.example.yaml @@ -39,7 +39,7 @@ runner: # The maximum interval for fetching the job from the Gitea instance. # The runner uses exponential backoff when idle, increasing the interval up to this maximum. # Set to 0 or same as fetch_interval to disable backoff. - fetch_interval_max: 5s + fetch_interval_max: 1m # While idle, remove stale bind-workdir task directories and orphaned host-mode # scratch directories (left behind when a host cleanup delete stalls) older than # this duration. Setting either workdir_cleanup_age or idle_cleanup_interval to 0 diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 240def9d..ed8ba483 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -183,7 +183,7 @@ func LoadDefault(file string) (*Config, error) { cfg.Runner.FetchInterval = 2 * time.Second } if cfg.Runner.FetchIntervalMax <= 0 { - cfg.Runner.FetchIntervalMax = 5 * time.Second + cfg.Runner.FetchIntervalMax = time.Minute } if cfg.Runner.WorkdirCleanupAge == 0 && !definedRunnerKeys["workdir_cleanup_age"] { cfg.Runner.WorkdirCleanupAge = 24 * time.Hour diff --git a/internal/pkg/config/config_test.go b/internal/pkg/config/config_test.go index 382aad48..83eb2a36 100644 --- a/internal/pkg/config/config_test.go +++ b/internal/pkg/config/config_test.go @@ -48,6 +48,12 @@ func TestLoadDefault_DefaultsWorkdirCleanupAge(t *testing.T) { assert.Equal(t, 10*time.Minute, cfg.Runner.IdleCleanupInterval) } +func TestLoadDefault_DefaultsIdleFetchBackoffMax(t *testing.T) { + cfg, err := LoadDefault("") + require.NoError(t, err) + assert.Equal(t, time.Minute, cfg.Runner.FetchIntervalMax) +} + func TestLoadDefault_UsesConfiguredWorkdirCleanupAge(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "config.yaml")