# HG changeset patch # User Kim Alvefur # Date 1493199982 -7200 # Node ID 9f17d0f28d773589dd0f11eed3292d1d6ee11e96 # Parent ec02ee02a04bf024b00b5fbb39eff0373668b286 mod_mam: Don't ask the storage backend to count all items when expiry is disabled diff -r ec02ee02a04b -r 9f17d0f28d77 mod_mam/mod_mam.lua --- a/mod_mam/mod_mam.lua Fri Jun 23 16:03:11 2017 +0200 +++ b/mod_mam/mod_mam.lua Wed Apr 26 11:46:22 2017 +0200 @@ -56,6 +56,8 @@ archive = module:require "fallback_archive"; end +local use_total = true; + local cleanup; -- Handle prefs. @@ -154,7 +156,7 @@ limit = qmax + 1; before = before; after = after; reverse = reverse; - total = true; + total = get_total; }); if not data then @@ -383,6 +385,10 @@ end return math.random(cleanup_interval, cleanup_interval * 2); end); +else + -- Don't ask the backend to count the potentially unbounded number of items, + -- it'll get slow. + use_total = false; end -- Stanzas sent by local clients