Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / repository / daemon / PhabricatorRepositoryPullLocalDaemonModule.php
blob45dc49d9af3d964fd55321a149246c02e51d04f1
1 <?php
3 final class PhabricatorRepositoryPullLocalDaemonModule
4 extends PhutilDaemonOverseerModule {
6 private $cursor = 0;
8 public function shouldWakePool(PhutilDaemonPool $pool) {
9 $class = $pool->getPoolDaemonClass();
10 if ($class != 'PhabricatorRepositoryPullLocalDaemon') {
11 return false;
14 if ($this->shouldThrottle($class, 1)) {
15 return false;
18 $table = new PhabricatorRepositoryStatusMessage();
19 $table_name = $table->getTableName();
20 $conn = $table->establishConnection('r');
22 $row = queryfx_one(
23 $conn,
24 'SELECT id FROM %T WHERE statusType = %s
25 AND id > %d ORDER BY id DESC LIMIT 1',
26 $table_name,
27 PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE,
28 $this->cursor);
30 if (!$row) {
31 return false;
34 $this->cursor = (int)$row['id'];
35 return true;