From e78b9fd4ee429f9291c699b2bf08c9b92bf3361f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 24 Jul 2017 16:33:07 +0200 Subject: [PATCH] hydra-queue-runner: Allow concurrent notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The queue runner can now run up to ‘max-concurrent-notifications’ in parallel (default is 2). This is useful when some hydra-notify invocations can take a long time to complete (e.g. because they need to compress a giant build log) and we don't want this to block all other notifications. --- src/hydra-queue-runner/hydra-queue-runner.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index c38c8021..2312eef9 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -833,7 +833,9 @@ void State::run(BuildID buildOne) std::thread(&State::dispatcher, this).detach(); /* Idem for notification sending. */ - std::thread(&State::notificationSender, this).detach(); + auto maxConcurrentNotifications = config->getIntOption("max-concurrent-notifications", 2); + for (uint64_t i = 0; i < maxConcurrentNotifications; ++i) + std::thread(&State::notificationSender, this).detach(); /* Periodically clean up orphaned busy steps in the database. */ std::thread([&]() {