Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scheduler time logic #2666

Merged
merged 5 commits into from
May 12, 2022
Merged

Add scheduler time logic #2666

merged 5 commits into from
May 12, 2022

Conversation

dnr
Copy link
Member

@dnr dnr commented Mar 29, 2022

What changed?
Add logic to implement schedule specs in temporalio/api#157

Why?
To be used by new scheduler service

How did you test it?
unit tests

Potential risks
nothing yet

@dnr dnr marked this pull request as ready for review April 22, 2022 23:31
@dnr dnr requested a review from a team as a code owner April 22, 2022 23:31
compiledCalendar struct {
tz *time.Location

year, month, dayOfMonth, dayOfWeek, hour, minute, second func(int) bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the input int and what is output bool?

Comment on lines 56 to 58
parseModeInt parseMode = iota
parseModeMonth
parseModeDow
Copy link
Member

@yiminc yiminc May 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some simple comments

}, nil
}

func parseStringSpec(s string, min, max int, parseMode parseMode, f func(int)) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need comments on what are the expected specs.
would be good to put some input example to help reader understand this code

after time.Time,
) (nominal, next time.Time, has bool) {
if cs.spec.StartTime != nil && after.Before(*cs.spec.StartTime) {
after = cs.spec.StartTime.Add(-time.Second)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why -1s? is that for jitter?

@dnr dnr enabled auto-merge (squash) May 12, 2022 19:50
@dnr dnr merged commit aba6e1f into temporalio:master May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants