On Sat, Dec 15, 2018 at 12:31 PM sri <kra...@gmail.com> wrote:

> a) you can now just use cron to enqueue unique jobs for you, and
>>
>
Hmm...  I think you mean this command?

./myapp.pl minion job -e foo -P 10023 -P 10024 -p 5 -q important

So if I wanted the Mojolicious app to control the schedule, it would need
to maintain the Mojolicious app's running-user crontab file.

My app would need to do something along the lines of:

(crontab -l ; echo "0 * * * * /path/to/myapp.pl minion job -e foo -P 10023
-P 10024 -p 5 -q important") | crontab -


A plugin could be written to handle this with maybe the help of something
like Config::Crontab <https://metacpan.org/pod/Config::Crontab>.  It could
also handle scheduling one-time jobs with `at`.

my $at = app->schedule->at(DateTime => 'job' => [@args]);
my $crontab = app->schedule->recurring('0 * * * *' => 'job' => [@args]);


And the Schedule plugin behind the scenes would execute `at` or `crontab`
accordingly.

You could delete the scheduled job with

app->schedule->remove($at, $contab, ...);


I'm thinking it would also be great to have a Mojo::Pg migrations-like
feature where it would make sure that the crontab has all of the necessary
jobs scheduled each time it launches.

app->schedule->migrations->name('clear_cache')->migrate(0)->migrate;


What do you think?  Does that sound reasonable?

>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to