Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemonModule.php
12242 views
1
<?php
2
3
final class PhabricatorTaskmasterDaemonModule
4
extends PhutilDaemonOverseerModule {
5
6
public function shouldWakePool(PhutilDaemonPool $pool) {
7
$class = $pool->getPoolDaemonClass();
8
9
if ($class != 'PhabricatorTaskmasterDaemon') {
10
return false;
11
}
12
13
if ($this->shouldThrottle($class, 1)) {
14
return false;
15
}
16
17
$table = new PhabricatorWorkerActiveTask();
18
$conn = $table->establishConnection('r');
19
20
$row = queryfx_one(
21
$conn,
22
'SELECT id FROM %T WHERE leaseOwner IS NULL
23
OR leaseExpires <= %d LIMIT 1',
24
$table->getTableName(),
25
PhabricatorTime::getNow());
26
if (!$row) {
27
return false;
28
}
29
30
return true;
31
}
32
33
}
34
35