This commit is contained in:
doomtube 2025-08-09 13:51:36 -04:00
parent 875a53f499
commit d812c6aeab
8 changed files with 2688 additions and 113 deletions

View file

@ -33,6 +33,10 @@ int main() {
LOG_INFO << "Loading configuration...";
app().loadConfigFile("config.json");
// Initialize StatsService BEFORE registering callbacks
LOG_INFO << "Initializing StatsService...";
StatsService::getInstance().initialize();
// Register a pre-routing advice to handle CORS
app().registerPreRoutingAdvice([](const HttpRequestPtr &req,
AdviceCallback &&acb,
@ -74,13 +78,13 @@ int main() {
resp->addHeader("Access-Control-Allow-Credentials", "true");
});
// Register beginning advice to initialize StatsService after app starts
// Register beginning advice to start the stats timer
app().registerBeginningAdvice([]() {
LOG_INFO << "Application started successfully";
// Initialize StatsService after app is running
LOG_INFO << "Initializing StatsService...";
StatsService::getInstance().initialize();
// Start the stats polling timer
LOG_INFO << "Starting stats polling...";
StatsService::getInstance().startPolling();
});
app().setTermSignalHandler([]() {