Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit668dbaa

Browse files
refactor: slightly change func signatures
1 parent693aafe commit668dbaa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎coderd/prebuilds/preset_snapshot.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
funcMatchesCron(cronExpressionstring,now time.Time) (bool,error) {
91+
funcMatchesCron(cronExpressionstring,at time.Time) (bool,error) {
9292
sched,err:=cron.Weekly(cronExpression)
9393
iferr!=nil {
9494
returnfalse,xerrors.Errorf("failed to parse cron expression: %w",err)
9595
}
9696

97-
returnsched.IsWithinRange(now),nil
97+
returnsched.IsWithinRange(at),nil
9898
}
9999

100-
func (pPresetSnapshot)CalculateDesiredInstances(now time.Time) (int32,error) {
100+
func (pPresetSnapshot)CalculateDesiredInstances(at time.Time) (int32,error) {
101101
if!p.Preset.AutoscalingEnabled {
102102
returnp.Preset.DesiredInstances.Int32,nil
103103
}
@@ -107,11 +107,11 @@ func (p PresetSnapshot) CalculateDesiredInstances(now time.Time) (int32, error)
107107
return0,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
113113
for_,schedule:=rangep.PrebuildSchedules {
114-
matches,err:=MatchesCron(schedule.CronExpression,now)
114+
matches,err:=MatchesCron(schedule.CronExpression,at)
115115
iferr!=nil {
116116
return0,xerrors.Errorf("failed to match cron expression: %w",err)
117117
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp