Skip to content

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