Open hasanparasteh opened 2 weeks ago
Well you two options:
A) Just run the function you pass it on start up
B) I'll add an @startup
schedule option to this package
Also I assume you might want to provide @startup
and the schedule you already had configured for it? So would also make that possible 👍 .
that would be great if we could have @startup
functionality
Not sure if it will be @start
up or a dedicated action that provides it yet. But will let you know when the PR is up
I use a package in golang
that has similar functionality. it's gocron and maybe we could use their idea. It's easy to use and has similar structure like reactphp-cron
. I'd happy if you take a look and let me know, If you decide anything to implement I would be happy to contribute.
for example we could accept some options as arguments just like gocron. It could be like below:
job, err := scheduler.NewJob(
gocron.DurationJob(
10*time.Minute,
),
gocron.NewTask(),
gocron.WithStartAt(gocron.WithStartImmediately()),
)
Public API isn't much of an issue, was looking at was of doing it clean and smart. But might end up doing an instanceof
internally to figure out which implementation is used to kick it off right away.
PR is up at https://github.com/WyriHaximus/reactphp-cron/pull/85, not super happy with the naming yet tbh
Sometimes we need to start long term actions immediately. Is there any solution available for this specific problem? Or should I implement it in a fork?