Diff

plugins/mod_storage_sql.lua @ 9890:b5ac12f97f34

mod_storage_sql: Fix to use currently queried store Was using the previously queried store due to this being cached in an upvalue.
author Kim Alvefur <zash@zash.se>
date Fri, 22 Mar 2019 02:10:46 +0100
parent 9889:e3ad2c845431
child 9891:147b28d001a0
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Fri Mar 22 02:09:38 2019 +0100
+++ b/plugins/mod_storage_sql.lua	Fri Mar 22 02:10:46 2019 +0100
@@ -238,7 +238,8 @@
 };
 archive_store.__index = archive_store
 function archive_store:append(username, key, value, when, with)
-	local cache_key = jid_join(username, host, self.store);
+	local user,store = username,self.store;
+	local cache_key = jid_join(username, host, store);
 	local item_count = archive_item_count_cache:get(cache_key);
 	if not item_count then
 		local ok, ret = engine:transaction(function()
@@ -265,7 +266,6 @@
 		return nil, "quota-limit";
 	end
 
-	local user,store = username,self.store;
 	when = when or os.time();
 	with = with or "";
 	local ok, ret = engine:transaction(function()