Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100464789
PhabricatorDaemonTaskGarbageCollector.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, Jan 31, 00:36
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Feb 2, 00:36 (2 d)
Engine
blob
Format
Raw Data
Handle
23968736
Attached To
rPH Phabricator
PhabricatorDaemonTaskGarbageCollector.php
View Options
<?php
final
class
PhabricatorDaemonTaskGarbageCollector
extends
PhabricatorGarbageCollector
{
public
function
collectGarbage
()
{
$key
=
'gcdaemon.ttl.task-archive'
;
$ttl
=
PhabricatorEnv
::
getEnvConfig
(
$key
);
if
(
$ttl
<=
0
)
{
return
false
;
}
$table
=
new
PhabricatorWorkerArchiveTask
();
$data_table
=
new
PhabricatorWorkerTaskData
();
$conn_w
=
$table
->
establishConnection
(
'w'
);
$rows
=
queryfx_all
(
$conn_w
,
'SELECT id, dataID FROM %T WHERE dateCreated < %d LIMIT 100'
,
$table
->
getTableName
(),
time
()
-
$ttl
);
if
(!
$rows
)
{
return
false
;
}
$data_ids
=
array_filter
(
ipull
(
$rows
,
'dataID'
));
$task_ids
=
ipull
(
$rows
,
'id'
);
$table
->
openTransaction
();
if
(
$data_ids
)
{
queryfx
(
$conn_w
,
'DELETE FROM %T WHERE id IN (%Ld)'
,
$data_table
->
getTableName
(),
$data_ids
);
}
queryfx
(
$conn_w
,
'DELETE FROM %T WHERE id IN (%Ld)'
,
$table
->
getTableName
(),
$task_ids
);
$table
->
saveTransaction
();
return
(
count
(
$task_ids
)
==
100
);
}
}
Event Timeline
Log In to Comment