@@ -88,16 +88,16 @@ func (ra *ReconciliationActions) IsNoop() bool {
8888
8989// MatchesCron checks if the given time matches the cron expression
9090// 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 ) {
9292sched ,err := cron .Weekly (cronExpression )
9393if err != nil {
9494return false ,xerrors .Errorf ("failed to parse cron expression: %w" ,err )
9595}
9696
97- return sched .IsWithinRange (now ),nil
97+ return sched .IsWithinRange (at ),nil
9898}
9999
100- func (p PresetSnapshot )CalculateDesiredInstances (now time.Time ) (int32 ,error ) {
100+ func (p PresetSnapshot )CalculateDesiredInstances (at time.Time ) (int32 ,error ) {
101101if ! p .Preset .AutoscalingEnabled {
102102return p .Preset .DesiredInstances .Int32 ,nil
103103}
@@ -107,11 +107,11 @@ func (p PresetSnapshot) CalculateDesiredInstances(now time.Time) (int32, error)
107107return 0 ,xerrors .Errorf ("can't parse location %v: %w" ,p .Preset .AutoscalingTimezone ,err )
108108}
109109
110- now = now .In (loc )
110+ at = at .In (loc )
111111
112112// Check each schedule
113113for _ ,schedule := range p .PrebuildSchedules {
114- matches ,err := MatchesCron (schedule .CronExpression ,now )
114+ matches ,err := MatchesCron (schedule .CronExpression ,at )
115115if err != nil {
116116return 0 ,xerrors .Errorf ("failed to match cron expression: %w" ,err )
117117}