Instance: flush input cache on SIGHUP
This commit is contained in:
@@ -198,3 +198,10 @@ Instance::OnIdle(unsigned flags) noexcept
|
||||
for (auto &partition : partitions)
|
||||
partition.EmitIdle(flags);
|
||||
}
|
||||
|
||||
void
|
||||
Instance::FlushCaches() noexcept
|
||||
{
|
||||
if (input_cache)
|
||||
input_cache->Flush();
|
||||
}
|
||||
|
||||
@@ -209,6 +209,8 @@ struct Instance final
|
||||
}
|
||||
#endif
|
||||
|
||||
void FlushCaches() noexcept;
|
||||
|
||||
private:
|
||||
#ifdef ENABLE_DATABASE
|
||||
/* virtual methods from class DatabaseListener */
|
||||
|
||||
@@ -47,10 +47,14 @@ x_sigaction(int signum, const struct sigaction *act)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_reload_event(void *) noexcept
|
||||
handle_reload_event(void *ctx) noexcept
|
||||
{
|
||||
LogDebug(signal_handlers_domain, "got SIGHUP, reopening log files");
|
||||
auto &instance = *(Instance *)ctx;
|
||||
|
||||
LogDebug(signal_handlers_domain, "got SIGHUP, reopening log files and flushing caches");
|
||||
cycle_log_files();
|
||||
|
||||
instance.FlushCaches();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -73,7 +77,7 @@ SignalHandlersInit(Instance &instance)
|
||||
SignalMonitorRegister(SIGINT, {&loop, HandleShutdownSignal});
|
||||
SignalMonitorRegister(SIGTERM, {&loop, HandleShutdownSignal});
|
||||
|
||||
SignalMonitorRegister(SIGHUP, {nullptr, handle_reload_event});
|
||||
SignalMonitorRegister(SIGHUP, {&instance, handle_reload_event});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user