MCPcopy Create free account
hub / github.com/github/gh-aw / addDailyCronWarning

Method addDailyCronWarning

pkg/workflow/schedule_preprocessing.go:466–487  ·  view source on GitHub ↗

addDailyCronWarning emits a warning when a daily cron pattern with fixed time is detected

(cronExpr string)

Source from the content-addressed store, hash-verified

464
465// addDailyCronWarning emits a warning when a daily cron pattern with fixed time is detected
466func (c *Compiler) addDailyCronWarning(cronExpr string) {
467 // Extract hour and minute from the cron expression
468 fields := strings.Fields(cronExpr)
469 if len(fields) >= 2 {
470 minute := fields[0]
471 hour := fields[1]
472 schedulePreprocessingLog.Printf("Warning: detected daily cron with fixed time: %s", cronExpr)
473
474 // Construct the warning message
475 warningMsg := fmt.Sprintf(
476 "Schedule uses fixed daily time (%s:%s UTC). Consider using fuzzy schedule 'daily' instead to distribute workflow execution times and reduce load spikes.",
477 hour, minute,
478 )
479
480 // This warning is added to the warning count
481 // It will be collected and displayed by the compilation process
482 c.IncrementWarningCount()
483
484 // Store the warning for later display
485 c.addScheduleWarning(warningMsg)
486 }
487}
488
489// addHourlyCronWarning emits a warning when an hourly interval with fixed minute is detected
490func (c *Compiler) addHourlyCronWarning(cronExpr string) {

Callers 1

Calls 3

IncrementWarningCountMethod · 0.95
addScheduleWarningMethod · 0.95
PrintfMethod · 0.45

Tested by

no test coverage detected