@@ -88,16 +88,16 @@ func (ra *ReconciliationActions) IsNoop() bool {
88
88
89
89
// MatchesCron checks if the given time matches the cron expression
90
90
// Assumes the time is already in the correct timezone
91
- func MatchesCron (cronExpression string , now time.Time ) (bool , error ) {
91
+ func MatchesCron (cronExpression string , at time.Time ) (bool , error ) {
92
92
sched , err := cron .Weekly (cronExpression )
93
93
if err != nil {
94
94
return false , xerrors .Errorf ("failed to parse cron expression: %w" , err )
95
95
}
96
96
97
- return sched .IsWithinRange (now ), nil
97
+ return sched .IsWithinRange (at ), nil
98
98
}
99
99
100
- func (p PresetSnapshot ) CalculateDesiredInstances (now time.Time ) (int32 , error ) {
100
+ func (p PresetSnapshot ) CalculateDesiredInstances (at time.Time ) (int32 , error ) {
101
101
if ! p .Preset .AutoscalingEnabled {
102
102
return p .Preset .DesiredInstances .Int32 , nil
103
103
}
@@ -107,11 +107,11 @@ func (p PresetSnapshot) CalculateDesiredInstances(now time.Time) (int32, error)
107
107
return 0 , xerrors .Errorf ("can't parse location %v: %w" , p .Preset .AutoscalingTimezone , err )
108
108
}
109
109
110
- now = now .In (loc )
110
+ at = at .In (loc )
111
111
112
112
// Check each schedule
113
113
for _ , schedule := range p .PrebuildSchedules {
114
- matches , err := MatchesCron (schedule .CronExpression , now )
114
+ matches , err := MatchesCron (schedule .CronExpression , at )
115
115
if err != nil {
116
116
return 0 , xerrors .Errorf ("failed to match cron expression: %w" , err )
117
117
}
0 commit comments