Implement an abstraction for the config (#358)

Fixes #321
This commit is contained in:
Alex Kremer
2022-11-01 17:59:23 +01:00
committed by GitHub
parent 8bd8ab9b8a
commit ea2837749a
22 changed files with 1159 additions and 326 deletions

View File

@@ -2,6 +2,7 @@
#define SUBSCRIPTION_MANAGER_H
#include <backend/BackendInterface.h>
#include <config/Config.h>
#include <memory>
#include <subscriptions/Message.h>
@@ -107,17 +108,10 @@ class SubscriptionManager
public:
static std::shared_ptr<SubscriptionManager>
make_SubscriptionManager(
boost::json::object const& config,
clio::Config const& config,
std::shared_ptr<Backend::BackendInterface const> const& b)
{
auto numThreads = 1;
if (config.contains("subscription_workers") &&
config.at("subscription_workers").is_int64())
{
numThreads = config.at("subscription_workers").as_int64();
}
auto numThreads = config.valueOr<uint64_t>("subscription_workers", 1);
return std::make_shared<SubscriptionManager>(numThreads, b);
}