diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-14 15:00:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-14 15:15:19 +0100 |
commit | b40fa1a48d076a675db58fffa302d26dabcd2519 (patch) | |
tree | 642679952939d7d04dd9bb1bb49205bbc76f53ab | |
parent | 904c6caebe5da551be410d88aa4dd86039f03a4c (diff) | |
download | rspamd-b40fa1a48d076a675db58fffa302d26dabcd2519.tar.gz rspamd-b40fa1a48d076a675db58fffa302d26dabcd2519.zip |
[Fix] Try to plug memory leak in metric exporter
-rw-r--r-- | src/plugins/lua/metric_exporter.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/lua/metric_exporter.lua b/src/plugins/lua/metric_exporter.lua index ee435b23b..b4b7756b4 100644 --- a/src/plugins/lua/metric_exporter.lua +++ b/src/plugins/lua/metric_exporter.lua @@ -26,7 +26,7 @@ local util = require "rspamd_util" local tcp = require "rspamd_tcp" local lua_util = require "lua_util" -local pool = mempool.create() +local pool local settings = { interval = 120, timeout = 15, @@ -125,7 +125,6 @@ local function graphite_push(kwargs) tcp.request({ ev_base = kwargs['ev_base'], config = rspamd_config, - pool = pool, host = settings['host'], port = settings['port'], timeout = settings['timeout'], @@ -176,6 +175,7 @@ rspamd_config:add_on_load(function (_, ev_base, worker) -- Exit unless we're the first 'controller' worker if not worker:is_primary_controller() then return end -- Persist mempool variable to statefile on shutdown + pool = mempool.create() rspamd_config:register_finish_script(function () local stamp = pool:get_variable(VAR_NAME, 'double') if not stamp then @@ -191,6 +191,7 @@ rspamd_config:add_on_load(function (_, ev_base, worker) f:write(pool:get_variable(VAR_NAME, 'double')) f:close() end + pool:destroy() end) -- Push metrics to backend local function push_metrics(time) |