@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorTaskmasterDaemonModule
4 extends PhutilDaemonOverseerModule {
5
6 public function shouldWakePool(PhutilDaemonPool $pool) {
7 $class = $pool->getPoolDaemonClass();
8
9 if ($class != PhabricatorTaskmasterDaemon::class) {
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}