@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Reduce parse latency for changes pushed to hosted repositories

Summary:
Currently, we can sit in a sleep() for up to 15 seconds (or longer, in some cases), even if there's a parse request.

Try polling the DB every second to see if we should wake up instead. This might or might not produce significant improvements, but seems OK to try and see.

Also a small fix for logging branch names with `%` in them, etc.

Test Plan: Ran `phd debug pulllocal` and pushed commits, saw them parse within a second.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, dctrwatson

Differential Revision: https://secure.phabricator.com/D7998

+13 -5
+12 -4
src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
··· 87 87 88 88 // If any repositories have the NEEDS_UPDATE flag set, pull them 89 89 // as soon as possible. 90 - $type_need_update = PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE; 91 - $need_update_messages = id(new PhabricatorRepositoryStatusMessage()) 92 - ->loadAllWhere('statusType = %s', $type_need_update); 90 + $need_update_messages = $this->loadRepositoryUpdateMessages(); 93 91 foreach ($need_update_messages as $message) { 94 92 $retry_after[$message->getRepositoryID()] = time(); 95 93 } ··· 184 182 $sleep_until = time() + $min_sleep; 185 183 } 186 184 187 - $this->sleep($sleep_until - time()); 185 + while (($sleep_until - time()) > 0) { 186 + $this->sleep(1); 187 + if ($this->loadRepositoryUpdateMessages()) { 188 + break; 189 + } 190 + } 188 191 } 189 192 } 190 193 194 + private function loadRepositoryUpdateMessages() { 195 + $type_need_update = PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE; 196 + return id(new PhabricatorRepositoryStatusMessage()) 197 + ->loadAllWhere('statusType = %s', $type_need_update); 198 + } 191 199 192 200 /** 193 201 * @task pull
+1 -1
src/applications/repository/engine/PhabricatorRepositoryEngine.php
··· 54 54 if ($this->getVerbose()) { 55 55 $console = PhutilConsole::getConsole(); 56 56 $argv = func_get_args(); 57 - $argv[0] = $argv[0]."\n"; 57 + array_unshift($argv, "%s\n"); 58 58 call_user_func_array(array($console, 'writeOut'), $argv); 59 59 } 60 60 return $this;