From be888170b27f4fdde9c02a11372baf9771b88845 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 1 Dec 2022 22:03:30 +0000 Subject: [PATCH] [Minor] Allow to skip hyperscan cleanup if RSPAMD_NO_CLEANUP env variable is set --- src/libserver/hyperscan_tools.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libserver/hyperscan_tools.cxx b/src/libserver/hyperscan_tools.cxx index b6c16e562..49b695cd2 100644 --- a/src/libserver/hyperscan_tools.cxx +++ b/src/libserver/hyperscan_tools.cxx @@ -30,6 +30,7 @@ #include /* for glob */ #include /* for unlink */ #include +#include /* for std::getenv */ #include "unix-std.h" #include "rspamd_control.h" @@ -184,7 +185,7 @@ public: auto cleanup_maybe() -> void { /* We clean dir merely if we are running from the main process */ - if (rspamd_current_worker == nullptr) { + if (rspamd_current_worker == nullptr && std::getenv("RSPAMD_NO_CLEANUP") == nullptr) { const auto *log_func = RSPAMD_LOG_FUNC; auto cleanup_dir = [&](std::string_view dir) -> void { for (const auto &ext : cache_extensions) { -- 2.39.5