Page MenuHomePhabricator

D11795.diff
No OneTemporary

D11795.diff

diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
--- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
+++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
@@ -27,6 +27,7 @@
final class PhabricatorRepositoryPullLocalDaemon
extends PhabricatorDaemon {
+ private $statusMessageCursor = 0;
/* -( Pulling Repositories )----------------------------------------------- */
@@ -259,8 +260,25 @@
*/
private function loadRepositoryUpdateMessages() {
$type_need_update = PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE;
- return id(new PhabricatorRepositoryStatusMessage())
- ->loadAllWhere('statusType = %s', $type_need_update);
+ $messages = id(new PhabricatorRepositoryStatusMessage())->loadAllWhere(
+ '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;
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 1:05 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723249
Default Alt Text
D11795.diff (1 KB)

Event Timeline