From ede0f79c3d20c18601b83172fd1f53dc84603920 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 29 Sep 2018 19:57:14 -0700 Subject: [PATCH] modules/s_conf: Eliminate the redundant conf reload after runlevel RUN transition. --- modules/media/media.cc | 17 +++++++++++------ modules/s_conf.cc | 7 +++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/modules/media/media.cc b/modules/media/media.cc index 9eb937ce2..b654e571c 100644 --- a/modules/media/media.cc +++ b/modules/media/media.cc @@ -19,6 +19,11 @@ IRCD_MODULE static const std::string dbopts; media = std::make_shared("media", dbopts, media_description); blocks = db::column{*media, "blocks"}; + + // The conf setter callbacks must be manually executed after + // the database was just loaded to set the cache size. + conf::reset("ircd.media.blocks.cache.size"); + conf::reset("ircd.media.blocks.cache_comp.size"); }, [] // fini { @@ -95,12 +100,6 @@ media_description media_blocks_descriptor, }; -decltype(media) -media; - -decltype(blocks) -blocks; - decltype(media_blocks_cache_size) media_blocks_cache_size { @@ -133,6 +132,12 @@ media_blocks_cache_comp_size } }; +decltype(media) +media; + +decltype(blocks) +blocks; + std::set downloading; diff --git a/modules/s_conf.cc b/modules/s_conf.cc index 2e70d6865..654150c42 100644 --- a/modules/s_conf.cc +++ b/modules/s_conf.cc @@ -52,7 +52,6 @@ on_run() const unwind uw{[] { item_error_log = true; }}; item_error_log = false; rehash_conf(false); - reload_conf(); } /// Waits for the daemon to transition to the RUN state so we can gather all @@ -129,14 +128,14 @@ noexcept try unquote(content.at("value")) }; + if(runlevel == runlevel::START && !conf::exists(key)) + return; + log::debug { "Updating conf [%s] => %s", key, value }; - if(runlevel == runlevel::START && !conf::exists(key)) - return; - ircd::conf::set(key, value); } catch(const std::exception &e)