[TYPO3-dev] Scheduler and Saving Task State

Jeff Segars jsegars at alumni.rice.edu
Thu Apr 29 16:09:30 CEST 2010


On 4/23/10 2:09 AM, Francois Suter wrote:
> Hi Jeff,
>
>> This appears to be due to tx_scheduler->executeTask() which runs
>> $task->save() prior to $task->execute. Is this the intended behavior? If
>> so, I guess the best option is to just write my data somewhere else for
>> saving rather than expecting my task to be persistent.
>
> The task is saved prior to actual execution because that triggers the
> calculation of the next execution date. Looking at this in retrospect
> doesn't make it look very clever. We would probably need 2 different
> methods: one that just saves the task and one that calculates next
> execution time and saves. That's a bit too late to have such a change in
> 4.4, but you may want to open a bug tracker issue so that we don't forget.
>
> About your current problem, I can see two solutions:
>
> 1) set the values to remember in some member variables of your task and
> call $this->save(). The risk you run is that a new time of next
> execution may be calculated if the task has run a long time and is
> already beyond the next execution time calculated during the first call
> to tx_scheduler::saveTask().
>
> 2) store the values that you need to recover in the new system registry.
> This is very easy and is documented in the latest version of Core APIs.
> The Scheduler does this itself to save information about its latest run.
>
> HTH


Just to follow up on this one, the registry worked great for trackign my 
current state. I've opened a bug report at 
http://bugs.typo3.org/view.php?id=14251 to hopefully get this changed in 
4.5.

Thanks!
Jeff




More information about the TYPO3-dev mailing list