Software /
code /
prosody
Diff
util/startup.lua @ 8653:dab9b8af0f01
util.startup: Execute startup routine inside async context
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 22 Mar 2018 16:24:22 +0000 |
parent | 8639:070a77c15f63 |
child | 8664:d49acc9a8da2 |
line wrap: on
line diff
--- a/util/startup.lua Thu Mar 22 16:23:06 2018 +0000 +++ b/util/startup.lua Thu Mar 22 16:24:22 2018 +0000 @@ -5,6 +5,7 @@ local prosody = { events = require "util.events".new() }; local config = require "core.configmanager"; +local async = require "util.async"; local dependencies = require "util.dependencies"; @@ -497,27 +498,29 @@ end function startup.prosody() - -- These actions are in a strict order, as many depend on - -- previous steps to have already been performed - startup.read_config(); - startup.sanity_check(); - startup.sandbox_require(); - startup.set_function_metatable(); - startup.check_dependencies(); - startup.load_libraries(); - startup.init_global_state(); - startup.init_logging(); - startup.chdir(); - startup.add_global_prosody_functions(); - startup.read_version(); - startup.log_greeting(); - startup.log_dependency_warnings(); - startup.load_secondary_libraries(); - startup.init_http_client(); - startup.init_data_store(); - startup.init_global_protection(); - startup.prepare_to_start(); - startup.notify_started(); + async.once(function () + -- These actions are in a strict order, as many depend on + -- previous steps to have already been performed + startup.read_config(); + startup.sanity_check(); + startup.sandbox_require(); + startup.set_function_metatable(); + startup.check_dependencies(); + startup.load_libraries(); + startup.init_global_state(); + startup.init_logging(); + startup.chdir(); + startup.add_global_prosody_functions(); + startup.read_version(); + startup.log_greeting(); + startup.log_dependency_warnings(); + startup.load_secondary_libraries(); + startup.init_http_client(); + startup.init_data_store(); + startup.init_global_protection(); + startup.prepare_to_start(); + startup.notify_started(); + end); end return startup;