Skip to content

Commit 5c801ec

Browse files
committed
Added initial delay to scheduler.
1 parent 73556ed commit 5c801ec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sources/radio/scheduler.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@
77

88
constexpr auto LABEL = "scheduler";
99
constexpr auto LOOP_TIMEOUT = std::chrono::milliseconds(100);
10+
constexpr auto UPDATE_INITIAL_DELAY = std::chrono::seconds(10);
1011
constexpr auto UPDATE_INTERVAL = std::chrono::minutes(60);
1112
constexpr auto SHIFT_FREQUENCY = Frequency(100000);
1213

1314
using namespace std::placeholders;
1415

1516
Scheduler::Scheduler(const Config& config, const Device& device, RemoteController& remoteController)
16-
: m_config(config), m_device(device), m_remoteController(remoteController), m_lastUpdateTime(0), m_isRefreshEnabled(true), m_isRunning(true), m_thread([this]() { worker(); }) {}
17+
: m_config(config),
18+
m_device(device),
19+
m_remoteController(remoteController),
20+
m_lastUpdateTime(getTime() - UPDATE_INTERVAL + UPDATE_INITIAL_DELAY),
21+
m_isRefreshEnabled(true),
22+
m_isRunning(true),
23+
m_thread([this]() { worker(); }) {}
1724

1825
Scheduler::~Scheduler() {
1926
m_isRunning = false;

0 commit comments

Comments
 (0)