7#include <unordered_map>
8#include <unordered_set>
11#include <userver/concurrent/variable.hpp>
13USERVER_NAMESPACE_BEGIN
23class PeriodicTaskControl
final {
25 bool RunPeriodicTask(
const std::string& name);
26 void SuspendPeriodicTasks(
const std::unordered_set<std::string>& names);
31 void RegisterPeriodicTask(
const std::string& name,
utils::PeriodicTask& task);
33 void UnregisterPeriodicTask(
const std::string& name,
utils::PeriodicTask& task);
35 utils::PeriodicTask& FindPeriodicTask(
const std::string& name);
37 concurrent::Variable<std::unordered_map<std::string, utils::PeriodicTask&>> periodic_tasks_;
43 PeriodicTaskRegistrationHolder(
44 PeriodicTaskControl& periodic_task_control,
46 utils::PeriodicTask& task
48 ~PeriodicTaskRegistrationHolder();
56 PeriodicTaskControl& periodic_task_control_;
58 utils::PeriodicTask& task_;