Page MenuHomePhabricator

D16585.id39920.diff
No OneTemporary

D16585.id39920.diff

diff --git a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
--- a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
@@ -682,7 +682,32 @@
$data['commitID'] = $commit->getID();
- PhabricatorWorker::scheduleTask($class, $data);
+ // If the repository is importing for the first time, we schedule tasks
+ // at IMPORT priority, which is very low. Making progress on importing a
+ // new repository for the first time is less important than any other
+ // daemon task.
+
+ // If the repostitory has finished importing and we're just catching up
+ // on recent commits, we schedule discovery at COMMIT priority, which is
+ // slightly below the default priority.
+
+ // Note that followup tasks and triggered tasks (like those generated by
+ // Herald or Harbormaster) will queue at DEFAULT priority, so that each
+ // commit tends to fully import before we start the next one. This tends
+ // to give imports fairly predictable progress. See T11677 for some
+ // discussion.
+
+ if ($repository->isImporting()) {
+ $task_priority = PhabricatorWorker::PRIORITY_IMPORT;
+ } else {
+ $task_priority = PhabricatorWorker::PRIORITY_COMMIT;
+ }
+
+ $options = array(
+ 'priority' => $task_priority,
+ );
+
+ PhabricatorWorker::scheduleTask($class, $data, $options);
}
private function isInitialImport(array $refs) {
diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
--- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
+++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
@@ -47,6 +47,14 @@
$this->getFollowupTaskClass(),
array(
'commitID' => $commit->getID(),
+ ),
+ array(
+ // We queue followup tasks at default priority so that the queue
+ // finishes work it has started before starting more work. If
+ // followups are queued at the same priority level, we do all
+ // message parses first, then all change parses, etc. This makes
+ // progress uneven. See T11677 for discussion.
+ 'priority' => PhabricatorWorker::PRIORITY_DEFAULT,
));
}
}
diff --git a/src/infrastructure/daemon/workers/PhabricatorWorker.php b/src/infrastructure/daemon/workers/PhabricatorWorker.php
--- a/src/infrastructure/daemon/workers/PhabricatorWorker.php
+++ b/src/infrastructure/daemon/workers/PhabricatorWorker.php
@@ -16,6 +16,7 @@
const PRIORITY_ALERTS = 1000;
const PRIORITY_DEFAULT = 2000;
+ const PRIORITY_COMMIT = 2500;
const PRIORITY_BULK = 3000;
const PRIORITY_IMPORT = 4000;

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 2:56 PM (21 h, 5 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6910885
Default Alt Text
D16585.id39920.diff (3 KB)

Event Timeline