mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 05:42:40 +01:00
Fix an issue where PullLocal daemon could spin in an error loop
Summary: Fixes T7106. If you have bad credentials AND you've pushed an "update this repository" message into the queue, the loop above this level ends up resetting the timer every time we go through it, so the daemon spins in a loop failing forever. Test Plan: - Created a repo with bad credentials. - Clicekd "updated now" to queue an update message. - Saw daemon run in a loop. - Applied patch, no loop. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7106 Differential Revision: https://secure.phabricator.com/D11795
This commit is contained in:
parent
52f724e6cf
commit
6a3824a61d
1 changed files with 20 additions and 2 deletions
|
@ -27,6 +27,7 @@
|
||||||
final class PhabricatorRepositoryPullLocalDaemon
|
final class PhabricatorRepositoryPullLocalDaemon
|
||||||
extends PhabricatorDaemon {
|
extends PhabricatorDaemon {
|
||||||
|
|
||||||
|
private $statusMessageCursor = 0;
|
||||||
|
|
||||||
/* -( Pulling Repositories )----------------------------------------------- */
|
/* -( Pulling Repositories )----------------------------------------------- */
|
||||||
|
|
||||||
|
@ -259,8 +260,25 @@ final class PhabricatorRepositoryPullLocalDaemon
|
||||||
*/
|
*/
|
||||||
private function loadRepositoryUpdateMessages() {
|
private function loadRepositoryUpdateMessages() {
|
||||||
$type_need_update = PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE;
|
$type_need_update = PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE;
|
||||||
return id(new PhabricatorRepositoryStatusMessage())
|
$messages = id(new PhabricatorRepositoryStatusMessage())->loadAllWhere(
|
||||||
->loadAllWhere('statusType = %s', $type_need_update);
|
'statusType = %s AND id > %d',
|
||||||
|
$type_need_update,
|
||||||
|
$this->statusMessageCursor);
|
||||||
|
|
||||||
|
// Keep track of messages we've seen so that we don't load them again.
|
||||||
|
// If we reload messages, we can get stuck a loop if we have a failing
|
||||||
|
// repository: we update immediately in response to the message, but do
|
||||||
|
// not clear the message because the update does not succeed. We then
|
||||||
|
// immediately retry. Instead, messages are only permitted to trigger
|
||||||
|
// an immediate update once.
|
||||||
|
|
||||||
|
foreach ($messages as $message) {
|
||||||
|
$this->statusMessageCursor = max(
|
||||||
|
$this->statusMessageCursor,
|
||||||
|
$message->getID());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue