Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I had the need to limit the number of jobs run not only by time but also number so I didn't reach a threshold on an external API. I was making 1000's of calls to the API a minute when my limit was 200 every 10 minutes and getting locked out for an hour.
Here is a patch to add this functionality. It adds a configuration to the admin screen. It also fixes a php warning when submitting the settings form without any function priority settings.
Cheers,
Neil
Comment | File | Size | Author |
---|---|---|---|
#1 | job_queue-max.patch | 1.36 KB | jchan |
job_queue-count.patch | 3.28 KB | indytechcook |
Comments
Comment #1
jchan CreditAttribution: jchan commentedI was thinking the same thing. My server has a limit on the number of emails sent per hour, so I wanted to use job_queue to stop Drupal from sending out more than that. Emails are the primary thing I use queueing for.
Could have saved myself some time if I had bothered to search here first.
Anyway, since I already made the patch, I'll just put it up here for what it's worth. It does not fix the php warning like Neil's does. It's for version 6.x-3.1.
Comment #2
Jonathan Webb CreditAttribution: Jonathan Webb commented+1 - Great feature addition! We are also using this module to send bulk email in batches using "queue mail" (to keep from triggering smtp quotas). I applied indytechcook's patch and it worked like a charm with 6.19
Comment #4
sepla CreditAttribution: sepla commentedBoth patches has been successfully tested against 6.x-3.x-dev.
Personally I prefer to use the simple one :) Thank you both.
Comment #5
sinasalek CreditAttribution: sinasalek commented+1