mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-05-09 00:33:24 +02:00
fix(report): swap log timer defaults so maxLatencyTimer is effective
- Change log_report_interval default from 3s to 5s (periodic sweep) - Change log_report_max_latency default from 5s to 3s (single-line guarantee) - Reverse config validation to warn when maxLatency >= interval - Add TestReporter_MaxLatencyTimer to verify single-line flush - Add TestReporter_BatchSizeFlush to verify batch threshold flush - Add TestReporter_StateNotifyFlush to verify step transition flush
This commit is contained in:
@@ -37,11 +37,13 @@ runner:
|
||||
# Set to 0 or same as fetch_interval to disable backoff.
|
||||
fetch_interval_max: 60s
|
||||
# The base interval for periodic log flush to the Gitea instance.
|
||||
# Logs may be sent earlier if the buffer reaches log_report_batch_size.
|
||||
log_report_interval: 3s
|
||||
# Logs may be sent earlier if the buffer reaches log_report_batch_size
|
||||
# or if log_report_max_latency expires after the first buffered row.
|
||||
log_report_interval: 5s
|
||||
# The maximum time a log row can wait before being sent.
|
||||
# This ensures even a single log line appears on the frontend within this duration.
|
||||
log_report_max_latency: 5s
|
||||
# Must be less than log_report_interval to have any effect.
|
||||
log_report_max_latency: 3s
|
||||
# Flush logs immediately when the buffer reaches this many rows.
|
||||
# This ensures bursty output (e.g., npm install) is delivered promptly.
|
||||
log_report_batch_size: 100
|
||||
|
||||
@@ -146,10 +146,10 @@ func LoadDefault(file string) (*Config, error) {
|
||||
cfg.Runner.FetchIntervalMax = 60 * time.Second
|
||||
}
|
||||
if cfg.Runner.LogReportInterval <= 0 {
|
||||
cfg.Runner.LogReportInterval = 3 * time.Second
|
||||
cfg.Runner.LogReportInterval = 5 * time.Second
|
||||
}
|
||||
if cfg.Runner.LogReportMaxLatency <= 0 {
|
||||
cfg.Runner.LogReportMaxLatency = 5 * time.Second
|
||||
cfg.Runner.LogReportMaxLatency = 3 * time.Second
|
||||
}
|
||||
if cfg.Runner.LogReportBatchSize <= 0 {
|
||||
cfg.Runner.LogReportBatchSize = 100
|
||||
@@ -164,10 +164,9 @@ func LoadDefault(file string) (*Config, error) {
|
||||
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",
|
||||
if cfg.Runner.LogReportMaxLatency >= cfg.Runner.LogReportInterval {
|
||||
log.Warnf("log_report_max_latency (%v) >= log_report_interval (%v), the max-latency timer will never fire before the periodic ticker; consider lowering log_report_max_latency",
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user