-
Notifications
You must be signed in to change notification settings - Fork 34
classes_tasks_taskpool.class
Daniel Spors edited this page Dec 19, 2023
·
2 revisions
Collect large number of same tasks into a pool and let it manage the processing without overloading the system. To add Tasks to a pool simply Depend them on it:
$pool = TaskPool::Async()->SetArg('processors',10);
for($i=0; $i<10000; $i++)
MyTask::Async()->SetArg('tasknum',$i)->DependsOn($pool);
$pool->Go(); Note that 'processors' must be a numeric value between 1 and 100, default is 5.
Extends: Task
INTERNAL Overwrites parent to fix 'run' method set up things.
INTERNAL Overwrites parent to fix 'run' method set up things.
Creates a reusable TaskPool. Will check the wdf_tasks table to see if there's already a Taskpool with the same name. If so it will be used, else a new one will be created.
Definition: public static function Reusable($name)
Returns: WdfTaskModel The new or loaded TaskPool
Parameters:
-
mixed $nameTaskPool name
INTERNAL TaskPool loop