Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101383287
PhabricatorTaskmasterDaemon.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
Sun, Feb 9, 22:19
Size
840 B
Mime Type
text/x-php
Expires
Tue, Feb 11, 22:19 (2 d)
Engine
blob
Format
Raw Data
Handle
24148976
Attached To
rPH Phabricator
PhabricatorTaskmasterDaemon.php
View Options
<?php
final
class
PhabricatorTaskmasterDaemon
extends
PhabricatorDaemon
{
public
function
run
()
{
$sleep
=
0
;
do
{
$tasks
=
id
(
new
PhabricatorWorkerLeaseQuery
())
->
setLimit
(
1
)
->
execute
();
if
(
$tasks
)
{
foreach
(
$tasks
as
$task
)
{
$id
=
$task
->
getID
();
$class
=
$task
->
getTaskClass
();
$this
->
log
(
"Working on task {$id} ({$class})..."
);
$task
=
$task
->
executeTask
();
$ex
=
$task
->
getExecutionException
();
if
(
$ex
)
{
$this
->
log
(
"Task {$id} failed!"
);
throw
$ex
;
}
else
{
$this
->
log
(
"Task {$id} complete! Moved to archive."
);
}
}
$sleep
=
0
;
}
else
{
$sleep
=
min
(
$sleep
+
1
,
30
);
}
$this
->
sleep
(
$sleep
);
}
while
(
true
);
}
}
Event Timeline
Log In to Comment