- Notifications
You must be signed in to change notification settings - Fork928
feat: add controls to template for determining startup days#10226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
0d09d4c
1975a45
2511a18
9af5475
3bac180
6cafda3
7812a9d
18c7093
352058b
4fdc57c
78257b8
db25e84
25c3b1b
51b8031
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -354,6 +354,17 @@ func isEligibleForAutostart(ws database.Workspace, build database.WorkspaceBuild | ||
// Truncate is probably not necessary here, but doing it anyway to be sure. | ||
nextTransition := sched.Next(build.CreatedAt).Truncate(time.Minute) | ||
// The nextTransition is when the auto start should kick off. If it lands on a | ||
// forbidden day, do not allow the auto start. We use the time location of the | ||
// schedule to determine the weekday. So if "Saturday" is disallowed, the | ||
// definition of "Saturday" depends on the location of the schedule. | ||
zonedTransition := nextTransition.In(sched.Location()) | ||
allowed := templateSchedule.AutostartRequirement.DaysMap()[zonedTransition.Weekday()] | ||
if !allowed { | ||
return false | ||
} | ||
Comment on lines +357 to +365 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is the affect on autostart | ||
// Must used '.Before' vs '.After' so equal times are considered "valid for autostart". | ||
return !currentTick.Before(nextTransition) | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.