Child pages
  • [unit configs] Allow registering Scheduled Task for other unit config [5.3.0-B1]
Skip to end of metadata
Go to start of metadata

The scheduled tasks is a way for a unit to perform song time consuming activities asynchronously from CRON. Currently each unit can only register it's own scheduled tasks. This doesn't sound like a restriction, but in world where each module can extend units from modules it's quite a restriction.

Solution

Allow specifying own/another unit prefix during scheduled task registration. Example:

$config = array(
	'ScheduledTasks' => array(
		'task_name' => Array('EventName' => 'unit-config-prefix:OnEventName', 'RunSchedule' => '*/30 * * * *'),
	),
);

It's also easy to implement, by changing 1 line in kUnitConfigReader::parseScheduledTasks method (5.2.x and below). Code was moved in 5.3.x release.

Related Tasks

1 Comment

  1. If we introduce scheduled task classes (each task is separate PHP class) so that they can be auto-discovered, then adding them from unit config would not be needed anymore.