mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-05-08 08:13:25 +02:00
fix(config): validate and fix invalid config combinations
- Warn and auto-correct when fetch_interval_max < fetch_interval - Warn and auto-correct when log_report_max_latency < log_report_interval - log_report_batch_size <= 0 already handled by existing default check Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -159,6 +159,18 @@ func LoadDefault(file string) (*Config, error) {
|
|||||||
cfg.Runner.StateReportInterval = 5 * time.Second
|
cfg.Runner.StateReportInterval = 5 * time.Second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate and fix invalid config combinations to prevent confusing behavior.
|
||||||
|
if cfg.Runner.FetchIntervalMax < cfg.Runner.FetchInterval {
|
||||||
|
log.Warnf("fetch_interval_max (%v) is less than fetch_interval (%v), setting fetch_interval_max to fetch_interval",
|
||||||
|
cfg.Runner.FetchIntervalMax, cfg.Runner.FetchInterval)
|
||||||
|
cfg.Runner.FetchIntervalMax = cfg.Runner.FetchInterval
|
||||||
|
}
|
||||||
|
if cfg.Runner.LogReportMaxLatency < cfg.Runner.LogReportInterval {
|
||||||
|
log.Warnf("log_report_max_latency (%v) is less than log_report_interval (%v), setting log_report_max_latency to log_report_interval",
|
||||||
|
cfg.Runner.LogReportMaxLatency, cfg.Runner.LogReportInterval)
|
||||||
|
cfg.Runner.LogReportMaxLatency = cfg.Runner.LogReportInterval
|
||||||
|
}
|
||||||
|
|
||||||
// although `container.network_mode` will be deprecated, but we have to be compatible with it for now.
|
// although `container.network_mode` will be deprecated, but we have to be compatible with it for now.
|
||||||
if cfg.Container.NetworkMode != "" && cfg.Container.Network == "" {
|
if cfg.Container.NetworkMode != "" && cfg.Container.Network == "" {
|
||||||
log.Warn("You are trying to use deprecated configuration item of `container.network_mode`, please use `container.network` instead.")
|
log.Warn("You are trying to use deprecated configuration item of `container.network_mode`, please use `container.network` instead.")
|
||||||
|
|||||||
Reference in New Issue
Block a user