-
Notifications
You must be signed in to change notification settings - Fork 3
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
remove Start() method #11
Comments
I think they look similar, but they are not same as Start facilitates running cron scheduler in its own goroutine while Run()-> runs the cron scheduler in current goroutine. |
Hi @rameshgkwd05, |
Hi @janfranchini About keeping Start or Run, I would go with Start as we usually run cron job in background, so does the Start method. |
There is for sure a reasonable motivation behind the current API. We are starting from scratch in terms of stable releases and the intent, for now, is to review the current state of the code.
This is a good point. I think too that the background usage would cover most (almost every IMO) of the cases. But as you said, Now, the point is that of finding a trade-off between having a single exposed method and both use cases being simple to deal with.
This all said, both ways sound fine to me, I definitely appreciate the idea of providing what's going to be used most of the time. It's more a style decision. @Zavy86, @inalto, what are your preferences? Once decided, @rameshgkwd05 would you like to open a PR for this? |
A use case I didn't consider is that of stopping the scheduler when using the first option I listed with blocking behavior. Using the second solution this behavior would be for free. This point makes me lean towards the second option. |
While trying to remove the Lines 93 to 112 in abf1acd
Consider the change when starting the scheduler in the above test: without goroutine synchronization, the scheduler could start after the |
Cron
provides two similar methods:Run()
andStart()
.cron/cron.go
Lines 214 to 235 in 5eb0ef7
I think that calling
go cron.Run()
the behavior would be the same ascron.Start()
. IMO we could removeStart()
and keep just theRun()
method, letting the user decide the execution goroutine on its own.The text was updated successfully, but these errors were encountered: