mosquito-cr / mosquito

A background task runner for crystal applications supporting periodic (CRON) and manually queued jobs
MIT License
227 stars 24 forks source link

Expiring jobs #41

Open greenbigfrog opened 4 years ago

greenbigfrog commented 4 years ago

Thanks for all the work that's gone into this. One feature I'd like to see added would be expiring jobs. If a job can't/isn't processed within/until X, it won't run. Example: if I add a job to the queue, I only want it to run within the next 30 seconds. If the worker is not running or doesn't process the job within 30 seconds, it shouldn't work the job.

I'll look into implementing this myself sometime the next week.

robacarp commented 4 years ago

@greenbigfrog thanks for looking and jumping in!

This idea fits into a broad category of a pre and post-exec hooks I've been eyeing adding. 🌵 Eventually, I'd like to move the throttling code into a pre-exec hook as well, which can be included into a Job class as needed.

greenbigfrog commented 4 years ago

Have you started work on the hook stuff yet somewhere?

On Wed, Feb 12, 2020, 21:59 robacarp notifications@github.com wrote:

@greenbigfrog https://github.com/greenbigfrog thanks for looking and jumping in!

This idea fits into a broad category of a pre and post-exec hooks I've been eyeing adding. 🌵 Eventually, I'd like to move the throttling code https://github.com/robacarp/mosquito/blob/master/src/mosquito/job.cr#L96-L111 into a pre-exec hook as well, which can be included into a Job class as needed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robacarp/mosquito/issues/41?email_source=notifications&email_token=ABPL27T7KUTCGQJQUM73OLDRCRPKBA5CNFSM4KTZRPV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELSLQBY#issuecomment-585414663, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPL27W4JOPCXYBAABV3SZ3RCRPKBANCNFSM4KTZRPVQ .

robacarp commented 4 years ago

Sorry, no