From: Mikhail Galanin Date: Thu, 26 Jul 2018 15:48:14 +0000 (+0100) Subject: [Minor] Fixed warning reported by luackeck X-Git-Tag: 1.7.9~33^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=05ea2e289cc95177928665b5e96cdf575f70d54a;p=rspamd.git [Minor] Fixed warning reported by luackeck --- diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua index f93d96c59..7b7312136 100644 --- a/src/plugins/lua/clickhouse.lua +++ b/src/plugins/lua/clickhouse.lua @@ -856,18 +856,18 @@ local function get_last_removal_ago() f:close() end - write_file, err = io.open(ts_file, 'w') - if err then - rspamd_logger.errx(rspamd_config, 'Failed to open %s, will not perform retention: %s', ts_file, err) - return nil - end - local current_ts = os.time() if last_ts == nil or (last_ts + settings.retention.period) <= current_ts then + write_file, err = io.open(ts_file, 'w') + if err then + rspamd_logger.errx(rspamd_config, 'Failed to open %s, will not perform retention: %s', ts_file, err) + return nil + end + local res res, err = write_file:write(tostring(current_ts)) - if err then + if err or res == nil then rspamd_logger.errx(rspamd_config, 'Failed to write %s, will not perform retention: %s', ts_file, err) return nil end