Software / code / prosody
Comparison
plugins/mod_storage_sql.lua @ 9896:dafe1b544822
mod_storage_sql: No archive item limit by default
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 22 Mar 2019 16:30:53 +0100 |
| parent | 9893:15270547c91c |
| child | 9904:bf061f5512f7 |
comparison
equal
deleted
inserted
replaced
| 9895:6bd65bff03b5 | 9896:dafe1b544822 |
|---|---|
| 148 return iterator(result); | 148 return iterator(result); |
| 149 end | 149 end |
| 150 | 150 |
| 151 --- Archive store API | 151 --- Archive store API |
| 152 | 152 |
| 153 local archive_item_limit = module:get_option_number("storage_archive_item_limit", 1000); | 153 local archive_item_limit = module:get_option_number("storage_archive_item_limit"); |
| 154 local archive_item_count_cache = cache.new(module:get_option("storage_archive_item_limit_cache_size", 1000)); | 154 local archive_item_count_cache = cache.new(module:get_option("storage_archive_item_limit_cache_size", 1000)); |
| 155 | 155 |
| 156 -- luacheck: ignore 512 431/user 431/store | 156 -- luacheck: ignore 512 431/user 431/store |
| 157 local map_store = {}; | 157 local map_store = {}; |
| 158 map_store.__index = map_store; | 158 map_store.__index = map_store; |
| 259 return nil, "Failure while checking quota"; | 259 return nil, "Failure while checking quota"; |
| 260 end | 260 end |
| 261 archive_item_count_cache:set(cache_key, item_count); | 261 archive_item_count_cache:set(cache_key, item_count); |
| 262 end | 262 end |
| 263 | 263 |
| 264 module:log("debug", "%s has %d items out of %d limit", username, item_count, archive_item_limit); | 264 if archive_item_limit then |
| 265 if item_count >= archive_item_limit then | 265 module:log("debug", "%s has %d items out of %d limit", username, item_count, archive_item_limit); |
| 266 return nil, "quota-limit"; | 266 if item_count >= archive_item_limit then |
| 267 return nil, "quota-limit"; | |
| 268 end | |
| 267 end | 269 end |
| 268 | 270 |
| 269 when = when or os.time(); | 271 when = when or os.time(); |
| 270 with = with or ""; | 272 with = with or ""; |
| 271 local ok, ret = engine:transaction(function() | 273 local ok, ret = engine:transaction(function() |