]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to skip hyperscan cleanup if RSPAMD_NO_CLEANUP env variable is set
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 1 Dec 2022 22:03:30 +0000 (22:03 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 1 Dec 2022 22:03:30 +0000 (22:03 +0000)
src/libserver/hyperscan_tools.cxx

index b6c16e5628be22b434153e526f5676ad35fee804..49b695cd27d68185a934ce3ab65ed29bb07bb7be 100644 (file)
@@ -30,6 +30,7 @@
 #include <glob.h> /* for glob */
 #include <unistd.h> /* for unlink */
 #include <optional>
+#include <cstdlib> /* 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) {