[development] How to control background processes from inside Drupal?

Brian Fending brian at fendinggroup.com
Mon May 10 14:26:13 UTC 2010

You might want to think about queue, which has been backported to D6. Here
are rough notes from John VanDyk's drupalcon sf preso on batch v. queue:


when to use batch:

 - when you're doing something that will exceed php's time-out

 - when you're writing something that could get large

 - when you want to give users feedback on what's going on

when to use queue

 - when you want to stash things for later processing

 - when you want to distribute computing

 - when you want to run queue "with a twist" (conditional outputs, other
processes kicked off, etc)


...not that those were particularly useful to your question, but they're a
basis. There are some details instructions in drupal_queue.module's
readme.txt (the backport from D7) that will help you decide whether running
a queue under a separate crontab (or even using drush) makes sense. If I
were in your position, I'd lean heavily in that direction not only for the
"offswitch", but for the option of distributing that computing down the
road, which is possible with queue.


On Mon, May 10, 2010 at 9:02 AM, Leo Burd <leob at media.mit.edu> wrote:

> Hello there,
> Is there any way to start/stop background processes from inside Drupal?
> I'm currently writing a module that has to continuously monitor  a socket
> connection for events coming from a remote server.  I thought about using
> hook_cron(), but I'm afraid that the infinite (or continuous) loop of my
> event handler would tie out other modules that use hook_cron().  Another
> alternative would be to use batch api, but do batch processes run in the
> background?
> Thanks in advance,
> Leo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100510/7f34b9af/attachment.html 

More information about the development mailing list