Comparison

plugins/mod_smacks.lua @ 13209:c8d949cf6b09

plugins: Switch to :get_option_period() for time range options Improves readability ("1 day" vs 86400) and centralizes validation.
author Kim Alvefur <zash@zash.se>
date Sun, 16 Jul 2023 20:49:33 +0200
parent 13023:cbe58f747d48
child 13213:50324f66ca2a
comparison
equal deleted inserted replaced
13208:a7c6ea1c5308 13209:c8d949cf6b09
65 65
66 local sm2_attr = { xmlns = xmlns_sm2 }; 66 local sm2_attr = { xmlns = xmlns_sm2 };
67 local sm3_attr = { xmlns = xmlns_sm3 }; 67 local sm3_attr = { xmlns = xmlns_sm3 };
68 68
69 local queue_size = module:get_option_number("smacks_max_queue_size", 500); 69 local queue_size = module:get_option_number("smacks_max_queue_size", 500);
70 local resume_timeout = module:get_option_number("smacks_hibernation_time", 600); 70 local resume_timeout = module:get_option_period("smacks_hibernation_time", "10 minutes");
71 local s2s_smacks = module:get_option_boolean("smacks_enabled_s2s", true); 71 local s2s_smacks = module:get_option_boolean("smacks_enabled_s2s", true);
72 local s2s_resend = module:get_option_boolean("smacks_s2s_resend", false); 72 local s2s_resend = module:get_option_boolean("smacks_s2s_resend", false);
73 local max_unacked_stanzas = module:get_option_number("smacks_max_unacked_stanzas", 0); 73 local max_unacked_stanzas = module:get_option_number("smacks_max_unacked_stanzas", 0);
74 local max_inactive_unacked_stanzas = module:get_option_number("smacks_max_inactive_unacked_stanzas", 256); 74 local max_inactive_unacked_stanzas = module:get_option_number("smacks_max_inactive_unacked_stanzas", 256);
75 local delayed_ack_timeout = module:get_option_number("smacks_max_ack_delay", 30); 75 local delayed_ack_timeout = module:get_option_period("smacks_max_ack_delay", 30);
76 local max_old_sessions = module:get_option_number("smacks_max_old_sessions", 10); 76 local max_old_sessions = module:get_option_number("smacks_max_old_sessions", 10);
77 77
78 local c2s_sessions = module:shared("/*/c2s/sessions"); 78 local c2s_sessions = module:shared("/*/c2s/sessions");
79 local local_sessions = prosody.hosts[module.host].sessions; 79 local local_sessions = prosody.hosts[module.host].sessions;
80 80