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 simple cron scheduling #22

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

Conversation

DS1S
Copy link

@DS1S DS1S commented Jun 27, 2024

This PR draft sets up basic cron scheduling. Currently only basic cron strings are accepted, i.e. numerics, wildcards, and steps.

Example usage within a main file can be seen below:

image

Currently, there is no support for specifiying specific days, i.e., Mon, Tue, Wed, Etc..

@DS1S DS1S changed the title Add simple cron scheduling WIP: Add simple cron scheduling Jun 28, 2024
}

func (s *Scheduler) Start(ctx context.Context) {
s.logger.Printf("Starting CRON scheduling with [%d] jobs.", len(s.jobs))
Copy link

@MrIceman MrIceman Jul 7, 2024

Choose a reason for hiding this comment

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

You might want to have a look attimers, you could just create a new timer for each cron job which would probably simplify your code even more
https://gobyexample.com/timers

Copy link
Author

Choose a reason for hiding this comment

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

I do not think it will necessarily simplify the code more than what it is, the body of it gorountine when dispacting a job will practically the same with replacing the time.sleep with a listening to the timer channel.

@DS1S DS1S changed the title WIP: Add simple cron scheduling Add simple cron scheduling Jul 14, 2024
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