Mercurial > prosody-hg
comparison core/modulemanager.lua @ 13361:e20949a10118
modulemanager: Allow modules to expose module.ready - to be called after init
This is a shortcut for module:on_ready() which exposes the functionality in an
idiomatic way consistent with module.load, module.unload, etc.
module.ready runs when the module is loaded and the server has finished
starting up.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 30 Nov 2023 10:09:47 +0000 |
| parents | ead41e25ebc0 |
| children | 601ec2c19180 |
comparison
equal
deleted
inserted
replaced
| 13360:6037b7a2131c | 13361:e20949a10118 |
|---|---|
| 291 if host ~= api_instance.host and module_has_method(pluginenv, "add_host") then | 291 if host ~= api_instance.host and module_has_method(pluginenv, "add_host") then |
| 292 -- Now load the module again onto the host it was originally being loaded on | 292 -- Now load the module again onto the host it was originally being loaded on |
| 293 ok, err = do_load_module(host, module_name); | 293 ok, err = do_load_module(host, module_name); |
| 294 end | 294 end |
| 295 end | 295 end |
| 296 | |
| 297 if module_has_method(pluginenv, "ready") then | |
| 298 pluginenv.module:on_ready(pluginenv.module.ready); | |
| 299 end | |
| 296 end | 300 end |
| 297 if not ok then | 301 if not ok then |
| 298 modulemap[api_instance.host][module_name] = nil; | 302 modulemap[api_instance.host][module_name] = nil; |
| 299 log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil"); | 303 log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil"); |
| 300 api_instance:set_status("warn", "Error during load (see log)"); | 304 api_instance:set_status("warn", "Error during load (see log)"); |
