diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-07-26 16:48:14 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-07-26 16:48:14 +0100 |
commit | 05ea2e289cc95177928665b5e96cdf575f70d54a (patch) | |
tree | 84fab5417a416703f2e2e7a4416943bc81a09dfa /src | |
parent | 1ba53e7f5aaee2ae2a5814c4b596cee58723fbf1 (diff) | |
download | rspamd-05ea2e289cc95177928665b5e96cdf575f70d54a.tar.gz rspamd-05ea2e289cc95177928665b5e96cdf575f70d54a.zip |
[Minor] Fixed warning reported by luackeck
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/clickhouse.lua | 14 |
1 files changed, 7 insertions, 7 deletions
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 |