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

How Can I schedule a job for 3 times a day, except sunday? #227

Closed
TheColonel2688 opened this issue Jan 31, 2019 · 4 comments
Closed

How Can I schedule a job for 3 times a day, except sunday? #227

TheColonel2688 opened this issue Jan 31, 2019 · 4 comments

Comments

@TheColonel2688
Copy link

TheColonel2688 commented Jan 31, 2019

How can I do something like this? Schedule a job for 3 times a day, except Sunday

Schedule().ToRunEvery(0).Days().Except(DayOfWeek.Sunday).At(06, 30).AndAt(14, 30).AndAt(22, 30);

Maybe this should be a feature request?

@VitorCioletti
Copy link

VitorCioletti commented Feb 1, 2019

Hi,
I guess there is no native support in the current API to do what you want. If you need a quick solution (and I know it is a messy one), run 3 schedules only on week days and the other 3 on saturday.

The current version(5.3.0) of the library will be deprecated by redesign branch, so there will be no new features on it. However, I liked Except(DayOfWeek) idea, and I believe AndAt(int) could be implemented by a new overload to At: At(IEnumerable<TimeSpan>), so there is no need to call AndAt(int, int) over and over again.

The newest version could be that simple:

run.Every().Day().Except(DayOfWeek.Sunday).At(myTimeSpanList))

@tallesl what do you think of these schedules?

:)

@TheColonel2688
Copy link
Author

Hi VitorCioletti,

That seems like a great syntax

@VitorCioletti VitorCioletti self-assigned this Feb 5, 2019
@VitorCioletti VitorCioletti removed their assignment Feb 5, 2019
@tallesl
Copy link
Contributor

tallesl commented Feb 5, 2019

run.Every().Day().Except(DayOfWeek.Sunday).At(myTimeSpanList)

A-OK with me.

Consider accepting params IEnumerable<DayOfWeek> and params IEnumerable<TimeSpan> on those.

@VitorCioletti VitorCioletti self-assigned this Feb 24, 2019
VitorCioletti added a commit to VitorCioletti/FluentScheduler that referenced this issue Feb 25, 2019
@VitorCioletti
Copy link

See #214 for release info.

tallesl pushed a commit that referenced this issue May 5, 2020
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

No branches or pull requests

3 participants