Comparison

plugins/mod_storage_sql.lua @ 9889:e3ad2c845431

mod_storage_sql: Don't increment counter twice (fixes accounting error)
author Kim Alvefur <zash@zash.se>
date Fri, 22 Mar 2019 02:09:38 +0100
parent 9885:64e16d1e91f6
child 9890:b5ac12f97f34
comparison
equal deleted inserted replaced
9888:5669bb11ac7b 9889:e3ad2c845431
283 if result then 283 if result then
284 item_count = item_count - result:affected(); 284 item_count = item_count - result:affected();
285 archive_item_count_cache:set(cache_key, item_count); 285 archive_item_count_cache:set(cache_key, item_count);
286 end 286 end
287 else 287 else
288 item_count = item_count + 1;
289 key = uuid.generate(); 288 key = uuid.generate();
290 end 289 end
291 local t, encoded_value = assert(serialize(value)); 290 local t, encoded_value = assert(serialize(value));
292 engine:insert(insert_sql, host, user or "", store, when, with, key, t, encoded_value); 291 engine:insert(insert_sql, host, user or "", store, when, with, key, t, encoded_value);
293 archive_item_count_cache:set(cache_key, item_count+1); 292 archive_item_count_cache:set(cache_key, item_count+1);