comparison mod_cloud_notify/mod_cloud_notify.lua @ 4367:33f82988d7a9

mod_cloud_notify: Make push_errors a shared table to persist across reloads and share with other modules
author Matthew Wild <mwild1@gmail.com>
date Thu, 21 Jan 2021 15:25:18 +0000
parents 31afa4f314cc
children e5493a10c4d1
comparison
equal deleted inserted replaced
4366:83370df0ce4a 4367:33f82988d7a9
20 local max_push_errors = module:get_option_number("push_max_errors", 16); 20 local max_push_errors = module:get_option_number("push_max_errors", 16);
21 local max_push_devices = module:get_option_number("push_max_devices", 5); 21 local max_push_devices = module:get_option_number("push_max_devices", 5);
22 local dummy_body = module:get_option_string("push_notification_important_body", "New Message!"); 22 local dummy_body = module:get_option_string("push_notification_important_body", "New Message!");
23 23
24 local host_sessions = prosody.hosts[module.host].sessions; 24 local host_sessions = prosody.hosts[module.host].sessions;
25 local push_errors = {}; 25 local push_errors = module:shared("push_errors");
26 local id2node = {}; 26 local id2node = {};
27 local id2identifier = {}; 27 local id2identifier = {};
28 28
29 -- For keeping state across reloads while caching reads 29 -- For keeping state across reloads while caching reads
30 -- This uses util.cache for caching the most recent devices and removing all old devices when max_push_devices is reached 30 -- This uses util.cache for caching the most recent devices and removing all old devices when max_push_devices is reached