[development] Batch API on cron
kb at 2bits.com
Thu Jul 15 14:11:49 UTC 2010
I ran into this before, and implemented a workaround.
No amount of unset() would free memory.
The workaround was to ration the number of loop iterations to do via the
script, and then end it and start a new one from where you left off.
#php CLI or drush script goes here
TOTAL=`expr $TOTAL + $NUM`
if [ $NUM = 0 ]; then
The PHP CLI or drush script returns the number of nodes processed. If it is
0 then the script exits. If there are more, then another iteration is done.
This way, PHP's memory does not grow indefinitely and then bombs out
On Thu, Jul 15, 2010 at 9:04 AM, Ken Rickard <agentrickard at gmail.com> wrote:
> Drush scripts (especially bulk node processing) are subject to hitting
> PHP memory limits when processing large amounts of data.
> Anyone have ways around that issue?
> On Thu, Jul 15, 2010 at 8:49 AM, Moshe Weitzman <weitzman at tejasa.com>
> > I think drush scripts are your best bet. CLI PHP is not not subject to
> > On Thu, Jul 15, 2010 at 5:01 AM, Sven Decabooter <sdecabooter at gmail.com>
> >> Hi,
> >> I'm reading contradicting posts about running Batch API processes on
> >> This is for Drupal 6 BTW.
> >> I have tried implementing a batch functionality that should be run on
> >> but it doesn't seem to process the work that needs to be done.
> >> I assume this is because running the cron through a commandline command
> >> So my questions:
> >> - Have I implemented Batch API incorrectly, and should it normally work
> >> on cron?
> >> - What is the best way to run a process that would normally trigger a
> >> script timeout? Can I use the Queue module for that?
> >> I'm sure plenty of people have already tried doing this, so I'm not sure
> >> I can find little consistent information about it.
> >> Thanks for your feedback.
> >> Sven
> Ken Rickard
> agentrickard at gmail.com
Khalid M. Baheyeldin
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
Simplicity is the ultimate sophistication. -- Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the development