else {
/* Legacy full cache update */
- /* After getting this notice, we can clean up old hyperscan files */
- rspamd_hyperscan_notice_loaded();
+ /*
+ * Only enable cleanup if hyperscan is not disabled.
+ * When disable_hyperscan is set, workers won't load databases
+ * and thus won't notify main about known files via
+ * RSPAMD_SRV_NOTICE_HYPERSCAN_CACHE. Enabling cleanup in that
+ * case would cause main to delete all cached files on exit.
+ */
+ if (!rspamd_main->cfg->disable_hyperscan) {
+ rspamd_hyperscan_notice_loaded();
+ }
msg_info_main("received hyperscan cache loaded");
rep.type = RSPAMD_CONTROL_HYPERSCAN_LOADED;
rep.id = cmd->id;
- msg_debug_hyperscan("received hyperscan loaded notification, forced=%d",
- cmd->cmd.hs_loaded.forced);
+ msg_info("received hyperscan loaded notification, forced=%d",
+ cmd->cmd.hs_loaded.forced);
/* All file operations go through Lua backend */
g_assert(rspamd_hs_cache_has_lua_backend());
- msg_debug_hyperscan("using async backend-based hyperscan loading");
rspamd_re_cache_load_hyperscan_scoped_async(cache, worker->srv->event_loop,
cache_dir, false);
rep.reply.hs_loaded.status = 0;