<br><br><div><span class="gmail_quote">On 3/12/07, <b class="gmail_sendername">Neil Drumm</b> &lt;<a href="mailto:drumm@delocalizedham.com">drumm@delocalizedham.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I sometimes find myself building a queue in a hook_cron()<br>implementation. I decided to make a separate module for this,<br>job_queue, <a href="http://drupal.org/project/job_queue">http://drupal.org/project/job_queue</a>
. It provides an API<br>which takes a function name and array of arguments for later execution<br>on cron. The only UI is a list of queued function calls.</blockquote><div><br>We implemented something similar to this for the CivicSpace ASP.&nbsp; In general, when people are looking for queues they tend to use other programming languages like Python that provide daemons as part of the core language.&nbsp; PHP&#39;s daemon capabilities are lacking so a queue supplements this missing piece with a cron job working through the queue.
<br><br>This is particular important when you want to put a lot of load but it can be spread out.&nbsp; For example, changing the schema of a thousand sites or re-indexing search tables for all sites in a multi-site configuration.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Is this functionality something that people would like to see in core?<br>Search module has a &#39;queue&#39; of unindexed content, would it benefit
<br>from having an abstracted queue?</blockquote><div><br>I&#39;d recommend the following features.<br><br>1) Error states for the queue.&nbsp; If a job fails it will set an error level.&nbsp; This is particularly useful for queue logging.
<br>2) A way to tell if queue jobs are still running. This would need to be set for each server instance empirically.&nbsp; If your queued job takes longer than the cron cycle, then you can get escalation issues.&nbsp; You&#39;ll want to know wether your server can process 1, 2, 3, or 10 jobs in the queue simultaneously.
<br>3) A global counter for multi-site configurations.&nbsp; If there is a queue, you probably want it to be aware of the resources being expended on other Drupal sites on the same server.<br><br>Cheers,<br>Kieran<br></div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">--<br>Neil Drumm<br><a href="http://delocalizedham.com">http://delocalizedham.com</a><br></blockquote>
</div><br><br clear="all"><br>-- <br>To strive, to seek, to find, and not to yield.<br>