moduleapi: Rename :once() to :on_ready() for clarity
'Once' is ambiguous - once per what?
on_ready() executes its parameter when the module is loaded *and* the server
has finished starting.
--- a/core/moduleapi.lua Thu Nov 30 09:47:00 2023 +0000
+++ b/core/moduleapi.lua Thu Nov 30 10:07:53 2023 +0000
@@ -781,8 +781,14 @@
end
-- Execute a function, once, but only after startup is complete
-function api:once(f) --luacheck: ignore 212/self
+function api:on_ready(f) --luacheck: ignore 212/self
return prosody.started:next(f);
end
+-- COMPAT w/post 0.12 trunk
+function api:once(f)
+ self:log("warn", "This module uses deprecated module:once() - switch to module:on_ready() or (better) expose function module.ready()");
+ return self:on_ready(f);
+end
+
return api;