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

Make scheduler use lastExecutedAt instead of next planned executeAt #73

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

evlekht
Copy link
Member

@evlekht evlekht commented Nov 26, 2024

  • Improves scheduler initial timer code to support canceling by context.
  • Modifies scheduled job: instead of next execution time, job now stores last execution time.

@evlekht evlekht marked this pull request as ready for review November 28, 2024 16:00
@evlekht evlekht changed the title Evlekht/cash in schedule Make scheduler use lastExecutedAt instead of next planned executeAt Nov 28, 2024
Comment on lines -167 to +176
executeAt := s.clock.Now().Add(period)

lastExecutedAt := time.Time{}
if job != nil {
job.Period = period
if executeAt.Before(job.ExecuteAt) {
job.ExecuteAt = executeAt
}
} else {
job = &Job{
Name: jobName,
ExecuteAt: executeAt,
Period: period,
}
lastExecutedAt = job.LastExecutedAt
Copy link
Contributor

Choose a reason for hiding this comment

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

@evlekht please update comment on line 159

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.

3 participants