# HG changeset patch # User Matthew Wild # Date 1701338873 0 # Node ID 6037b7a2131c5be0b6199165948946186575639c # Parent 1796370091d4c591f7d9f604693c7bd390289c8b 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. diff -r 1796370091d4 -r 6037b7a2131c core/moduleapi.lua --- 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;