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 support for a .Delay(x) for recurrent jobs #16

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

Conversation

keymon
Copy link

@keymon keymon commented Jun 13, 2018

In ocassions we want to add some delay to a recurrent job that is different to the recurrent period itself.

I add a .Delay() modifier that changes the time for the initial delay. This
in incompatible to NotImmediatelly().

I added here two possible implementation in two different commits:

  • .Delay(10 * time.Second): we pass a time.Duration directly
  • .Delay(10).Seconds(): more complex and magic behaviour, it behaves
    like Every(x), but nicer to read

Let me know which one you like the most and I can rebase this PR (or just merge it if you like it :))

keymon added 2 commits June 13, 2018 18:04
In ocassions we want to add some delay to a recurrent job that
is different to the recurrent period itself.

We add a .Delay(time) method to add such delay.

It returns the given time on the first call of nextRun()
We want .Delay(x) to work in a similar way to Every(x), where you
can pass the duration unit after.

This results in more significant syntax:

       scheduler.Every(5).Minutes().Delay(10).Seconds().Run(job)
@coveralls
Copy link

coveralls commented Jun 13, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling c8fecd8 on keymon:add_delayed_start into ee74d2f on carlescere:master.

@keymon keymon force-pushed the add_delayed_start branch from 2acdc42 to c8fecd8 Compare June 13, 2018 20:05
@keymon
Copy link
Author

keymon commented Jun 13, 2018

Not sure why travis fails for go1.2, it seems it does not install the cover tool. I tried to reproduce it myself with go1.2.2, but I couldn't.

@keymon
Copy link
Author

keymon commented Aug 29, 2018

Hello @carlescere, any feedback about this?

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.

2 participants