Releases: aternosorg/taskmaster
Releases · aternosorg/taskmaster
v1.2.0
v1.1.4
Allow definition of init task after adding workers
Full Changelog: v1.1.3...v1.1.4
v1.1.3
v1.1.2
v1.1.1
v1.1.0
Added init tasks
You can now define tasks that are executed on every worker instance before the first task is executed.
This is helpful to run some initial setup or (in case of the ForkWorker
)
to clear some variables that are inherited from the parent process, e.g. database connections.
// init tasks are always provided by a task factory
$taskmaster->setDefaultInitTaskFactory(new InitTaskFactory());
// but taskmaster can create task factories automatically by cloning or instancing a task
$taskmaster->setDefaultInitTask(new InitTask());
$taskmaster->setDefaultInitTask(InitTask::class);
// you can also define a task factory for a specific worker
$worker->setInitTaskFactory(new InitTaskFactory());