refactor cron

This commit is contained in:
Doug Hoyte
2023-02-19 01:24:31 -05:00
parent 524118c7a5
commit d5cb732cd4
3 changed files with 84 additions and 80 deletions

View File

@ -32,6 +32,10 @@ void RelayServer::run() {
runYesstr(thr);
});
cronThread = std::thread([this]{
runCron();
});
// Monitor for config file reloads
auto configFileChangeWatcher = hoytech::file_change_monitor(configFile);
@ -42,19 +46,6 @@ void RelayServer::run() {
loadConfig(configFile);
});
// Cron
cron.repeat(10 * 1'000'000UL, [&]{
cleanupOldEvents();
});
cron.repeat(60 * 60 * 1'000'000UL, [&]{
garbageCollect();
});
cron.setupCb = []{ setThreadName("cron"); };
cron.run();
tpWebsocket.join();
}