addDailyCronWarning emits a warning when a daily cron pattern with fixed time is detected
(cronExpr string)
| 464 | |
| 465 | // addDailyCronWarning emits a warning when a daily cron pattern with fixed time is detected |
| 466 | func (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 |
| 490 | func (c *Compiler) addHourlyCronWarning(cronExpr string) { |
no test coverage detected