hydra-queue-runner: Allow concurrent notifications

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.
This commit is contained in:
Eelco Dolstra 2017-07-24 16:33:07 +02:00
parent bba383bf1b
commit e78b9fd4ee
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -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([&]() {