go-co-op / gocron

Easy and fluent Go cron scheduling. This is a fork from https://github.com/jasonlvhit/gocron
MIT License
5.68k stars 309 forks source link

[FEATURE] - Several potential changes #762

Open pcfreak30 opened 4 months ago

pcfreak30 commented 4 months ago

I believe this would need to be several PR's, but I want feedback on if they should be refactored upstream, the best approach?

https://github.com/go-co-op/gocron/compare/v2...LumeWeb:gocron:expose_started_locker

Summary of changes:

@JohnRoesler

JohnRoesler commented 4 months ago

@pcfreak30 I can see the value in these features beyond your use. Happy to review a PR. The diff you have looks pretty straightforward, just some comments and such needed 👍

pcfreak30 commented 4 months ago

One thing came to mind, would the startedChan be better off as some sort of callback for a "before start" as a job option?

as it stands I think it would need to be a go routine anyways to not block. but my case always uses it ATM.

Thoughts?

JohnRoesler commented 4 months ago

Good point, could do away with startedChan as you can just use the existing https://pkg.go.dev/github.com/go-co-op/gocron/v2#BeforeJobRuns event listener

pcfreak30 commented 1 month ago

@JohnRoesler i have created 2 prs that should sum up everything