1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 19:22:42 +01:00

Allow the PullLocal daemon to actually hibernate

Summary:
Ref T12298. The PullLocal daemon has had hibernation code for a little while, but it never actually activated because we don't sleep for more than 15 seconds in any case.

Add a maximum sleep instead and use that to control the longest sleep we'll do for hibernation purposes.

Also, when a repository or repository URI is edited, write a NEEDS_UPDATE event into the message table to make sure the daemons de-hibernate.

Test Plan: Used `bin/phd debug pull`, saw the daemon actually hibernate instead of just sleeping for 15 seconds.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12298

Differential Revision: https://secure.phabricator.com/D17635
This commit is contained in:
epriestley 2017-04-06 15:17:35 -07:00
parent f1eeaaf59f
commit 845a7d8716
3 changed files with 10 additions and 1 deletions

View file

@ -507,6 +507,10 @@ final class DiffusionURIEditor
->synchronizeWorkingCopyAfterHostingChange(); ->synchronizeWorkingCopyAfterHostingChange();
} }
$repository->writeStatusMessage(
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE,
null);
return $xactions; return $xactions;
} }

View file

@ -68,6 +68,7 @@ final class PhabricatorRepositoryPullLocalDaemon
$retry_after = array(); $retry_after = array();
$min_sleep = 15; $min_sleep = 15;
$max_sleep = phutil_units('5 minutes in seconds');
$max_futures = 4; $max_futures = 4;
$futures = array(); $futures = array();
$queue = array(); $queue = array();
@ -228,7 +229,7 @@ final class PhabricatorRepositoryPullLocalDaemon
continue; continue;
} }
$should_hibernate = $this->waitForUpdates($min_sleep, $retry_after); $should_hibernate = $this->waitForUpdates($max_sleep, $retry_after);
if ($should_hibernate) { if ($should_hibernate) {
break; break;
} }

View file

@ -634,6 +634,10 @@ final class PhabricatorRepositoryEditor
->synchronizeWorkingCopyAfterCreation(); ->synchronizeWorkingCopyAfterCreation();
} }
$object->writeStatusMessage(
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE,
null);
return $xactions; return $xactions;
} }