comparison mod_measure_active_users/mod_measure_active_users.lua @ 5863:ca62f9984f4b

mod_measure_active_users: Switch to mod_cron for scheduling
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Mar 2024 10:56:41 +0000
parents 9d3d719db285
children 908d44cfb693
comparison
equal deleted inserted replaced
5862:9f2816287556 5863:ca62f9984f4b
39 end 39 end
40 module:log("debug", "Active users (took %ds): %d (24h), %d (7d), %d (30d)", os.time()-now, active_d1, active_d7, active_d30); 40 module:log("debug", "Active users (took %ds): %d (24h), %d (7d), %d (30d)", os.time()-now, active_d1, active_d7, active_d30);
41 measure_d1(active_d1); 41 measure_d1(active_d1);
42 measure_d7(active_d7); 42 measure_d7(active_d7);
43 measure_d30(active_d30); 43 measure_d30(active_d30);
44
45 return 3600 + (300*math.random());
46 end 44 end
47 45
46 -- Schedule at startup
48 module:add_timer(15, update_calculations); 47 module:add_timer(15, update_calculations);
48
49 -- Recalculate hourly
50 module:hourly(update_calculations);