Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892946
PhabricatorWorkerManagementFreeWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorWorkerManagementFreeWorkflow.php
View Options
<?php
final
class
PhabricatorWorkerManagementFreeWorkflow
extends
PhabricatorWorkerManagementWorkflow
{
protected
function
didConstruct
(
)
{
$this
->
setName
(
'free'
)
->
setExamples
(
'**free** __selectors__'
)
->
setSynopsis
(
pht
(
'Free leases on selected tasks. If the daemon holding the lease is '
.
'still working on the task, this may cause the task to execute '
.
'twice.'
)
)
->
setArguments
(
$this
->
getTaskSelectionArguments
(
)
)
;
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$tasks
=
$this
->
loadTasks
(
$args
)
;
if
(
!
$tasks
)
{
$this
->
logWarn
(
pht
(
'NO TASKS'
)
,
pht
(
'No tasks selected to free leases on.'
)
)
;
return
0
;
}
$free_count
=
0
;
foreach
(
$tasks
as
$task
)
{
if
(
$task
->
isArchived
(
)
)
{
$this
->
logWarn
(
pht
(
'ARCHIVED'
)
,
pht
(
'%s is archived; archived tasks do not have leases.'
,
$this
->
describeTask
(
$task
)
)
)
;
continue
;
}
if
(
$task
->
getLeaseOwner
(
)
===
null
)
{
$this
->
logWarn
(
pht
(
'FREE'
)
,
pht
(
'%s has no active lease.'
,
$this
->
describeTask
(
$task
)
)
)
;
continue
;
}
$task
->
setLeaseOwner
(
null
)
->
setLeaseExpires
(
PhabricatorTime
::
getNow
(
)
)
->
save
(
)
;
$this
->
logInfo
(
pht
(
'LEASE FREED'
)
,
pht
(
'%s was freed from its lease.'
,
$this
->
describeTask
(
$task
)
)
)
;
$free_count
++
;
}
$this
->
logOkay
(
pht
(
'DONE'
)
,
pht
(
'Freed %s task lease(s).'
,
new
PhutilNumber
(
$free_count
)
)
)
;
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 17:36 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127026
Default Alt Text
PhabricatorWorkerManagementFreeWorkflow.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment