Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92691933
PhabricatorScheduleTaskTriggerAction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 22, 20:01
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 20:01 (2 d)
Engine
blob
Format
Raw Data
Handle
22488288
Attached To
rPH Phabricator
PhabricatorScheduleTaskTriggerAction.php
View Options
<?php
/**
* Trigger action which queues a task.
*
* Most triggers should take this action: triggers need to execute as quickly
* as possible, and should generally queue tasks instead of doing any real
* work.
*
* In some cases, triggers could execute more quickly by examining the
* scheduled action time and comparing it to the current time, then exiting
* early if the trigger is executing too far away from real time (for example,
* it might not make sense to send a meeting reminder after a meeting already
* happened).
*
* However, in most cases the task needs to have this logic anyway (because
* there may be another arbitrarily long delay between when this code executes
* and when the task executes), and the cost of queueing a task is very small,
* and situations where triggers are executing far away from real time should
* be rare (major downtime or serious problems with the pipeline).
*
* The properties of this action map to the parameters of
* @{method:PhabricatorWorker::scheduleTask}.
*/
final
class
PhabricatorScheduleTaskTriggerAction
extends
PhabricatorTriggerAction
{
public
function
validateProperties
(
array
$properties
)
{
PhutilTypeSpec
::
checkMap
(
$properties
,
array
(
'class'
=>
'string'
,
'data'
=>
'map<string, wild>'
,
'options'
=>
'map<string, wild>'
,
));
}
public
function
execute
(
$last_epoch
,
$this_epoch
)
{
PhabricatorWorker
::
scheduleTask
(
$this
->
getProperty
(
'class'
),
$this
->
getProperty
(
'data'
)
+
array
(
'trigger.last-epoch'
=>
$last_epoch
,
'trigger.this-epoch'
=>
$this_epoch
,
),
$this
->
getProperty
(
'options'
));
}
}
Event Timeline
Log In to Comment