Mercurial > prosody-hg
comparison util/startup.lua @ 8682:151ecd18d624
prosody, util.startup: Switch from async.once() to long-lived thread, to avoid GC
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 23 Mar 2018 14:18:27 +0000 |
| parents | 6aeed79d9283 |
| children | 019b4b3dd5ad |
comparison
equal
deleted
inserted
replaced
| 8681:0c077800cd70 | 8682:151ecd18d624 |
|---|---|
| 3 local startup = {}; | 3 local startup = {}; |
| 4 | 4 |
| 5 local prosody = { events = require "util.events".new() }; | 5 local prosody = { events = require "util.events".new() }; |
| 6 | 6 |
| 7 local config = require "core.configmanager"; | 7 local config = require "core.configmanager"; |
| 8 local async = require "util.async"; | |
| 9 | 8 |
| 10 local dependencies = require "util.dependencies"; | 9 local dependencies = require "util.dependencies"; |
| 11 | 10 |
| 12 local original_logging_config; | 11 local original_logging_config; |
| 13 | 12 |
| 499 startup.init_http_client(); | 498 startup.init_http_client(); |
| 500 startup.make_dummy_hosts(); | 499 startup.make_dummy_hosts(); |
| 501 end | 500 end |
| 502 | 501 |
| 503 function startup.prosody() | 502 function startup.prosody() |
| 504 async.once(function () | 503 -- These actions are in a strict order, as many depend on |
| 505 -- These actions are in a strict order, as many depend on | 504 -- previous steps to have already been performed |
| 506 -- previous steps to have already been performed | 505 startup.read_config(); |
| 507 startup.read_config(); | 506 startup.sanity_check(); |
| 508 startup.sanity_check(); | 507 startup.sandbox_require(); |
| 509 startup.sandbox_require(); | 508 startup.set_function_metatable(); |
| 510 startup.set_function_metatable(); | 509 startup.check_dependencies(); |
| 511 startup.check_dependencies(); | 510 startup.load_libraries(); |
| 512 startup.load_libraries(); | 511 startup.init_global_state(); |
| 513 startup.init_global_state(); | 512 startup.init_logging(); |
| 514 startup.init_logging(); | 513 startup.chdir(); |
| 515 startup.chdir(); | 514 startup.add_global_prosody_functions(); |
| 516 startup.add_global_prosody_functions(); | 515 startup.read_version(); |
| 517 startup.read_version(); | 516 startup.log_greeting(); |
| 518 startup.log_greeting(); | 517 startup.log_dependency_warnings(); |
| 519 startup.log_dependency_warnings(); | 518 startup.load_secondary_libraries(); |
| 520 startup.load_secondary_libraries(); | 519 startup.init_http_client(); |
| 521 startup.init_http_client(); | 520 startup.init_data_store(); |
| 522 startup.init_data_store(); | 521 startup.init_global_protection(); |
| 523 startup.init_global_protection(); | 522 startup.prepare_to_start(); |
| 524 startup.prepare_to_start(); | 523 startup.notify_started(); |
| 525 startup.notify_started(); | |
| 526 end); | |
| 527 end | 524 end |
| 528 | 525 |
| 529 return startup; | 526 return startup; |
