mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-19 01:34:57 +00:00
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#include "RelayServer.h"
|
|
|
|
|
|
|
|
void cmd_relay(const std::vector<std::string> &subArgs) {
|
|
RelayServer s;
|
|
s.run();
|
|
}
|
|
|
|
void RelayServer::run() {
|
|
tpWebsocket.init("Websocket", 1, [this](auto &thr){
|
|
runWebsocket(thr);
|
|
});
|
|
|
|
tpIngester.init("Ingester", cfg().relay__numThreads__ingester, [this](auto &thr){
|
|
runIngester(thr);
|
|
});
|
|
|
|
tpWriter.init("Writer", 1, [this](auto &thr){
|
|
runWriter(thr);
|
|
});
|
|
|
|
tpReqWorker.init("ReqWorker", cfg().relay__numThreads__reqWorker, [this](auto &thr){
|
|
runReqWorker(thr);
|
|
});
|
|
|
|
tpReqMonitor.init("ReqMonitor", cfg().relay__numThreads__reqMonitor, [this](auto &thr){
|
|
runReqMonitor(thr);
|
|
});
|
|
|
|
tpNegentropy.init("Negentropy", cfg().relay__numThreads__negentropy, [this](auto &thr){
|
|
runNegentropy(thr);
|
|
});
|
|
|
|
cronThread = std::thread([this]{
|
|
runCron();
|
|
});
|
|
|
|
// Monitor for config file reloads
|
|
|
|
auto configFileChangeWatcher = hoytech::file_change_monitor(configFile);
|
|
|
|
configFileChangeWatcher.setDebounce(100);
|
|
|
|
configFileChangeWatcher.run([&](){
|
|
loadConfig(configFile);
|
|
});
|
|
|
|
|
|
tpWebsocket.join();
|
|
}
|