mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-27 19:17:47 +01:00
Return time.Time{} when cron string is empty (#17289)
change log level to debug to avoid noise Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
parent
b4f2f170b4
commit
66d34c8e0c
@ -284,10 +284,13 @@ func FindNamedMatches(regex *regexp.Regexp, str string) map[string]string {
|
||||
// the cron string could contain 6 tokens
|
||||
// if the cron string is invalid, it returns a zero time
|
||||
func NextSchedule(cron string, curTime time.Time) time.Time {
|
||||
if len(cron) == 0 {
|
||||
return time.Time{}
|
||||
}
|
||||
cr := strings.TrimSpace(cron)
|
||||
s, err := CronParser().Parse(cr)
|
||||
if err != nil {
|
||||
log.Errorf("the cron string %v is invalid, error: %v", cron, err)
|
||||
log.Debugf("the cron string %v is invalid, error: %v", cron, err)
|
||||
return time.Time{}
|
||||
}
|
||||
return s.Next(curTime)
|
||||
|
Loading…
Reference in New Issue
Block a user