Any documentation for Custom Deferred Task?

kkarki

Member
Hello Folks,

It would be great if someone could point out how exactly a new custom deferred task can be added to the system?

For example, I've created a class "library/DemoDeferredTask/Deferred/DemoTask.php" as shown following.

<?php
class DemoDeferredTask_Deferred_DemoTask extends XenForo_Deferred_Abstract
{
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{

// Do some heavy processing here

return false;
}
}

Couple of queries:

- Does my custom deferred class will be called automatically Or I would need to make some entries in addon Xml file so that it would get installed to the XF system?

- Also, do I need to process everything at once Or should I use something like this as shown in core?

if ($targetRunTime && microtime(true) - $s > $targetRunTime)
{
$continue = true;
break;
}

if (!$continue)
{
return false;
}

Any help would be greatly appreciated as I'm just trying to get my foots in the XF system.
 
Top Bottom