commit be88817: [Minor] Allow to skip hyperscan cleanup if RSPAMD_NO_CLEANUP env variable is set

Vsevolod Stakhov vsevolod at rspamd.com
Thu Dec 1 22:35:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-12-01 22:03:30 +0000
URL: https://github.com/rspamd/rspamd/commit/be888170b27f4fdde9c02a11372baf9771b88845

[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 <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) {


More information about the Commits mailing list