moonraker: don't use a set to load initial components

Previously a set was used to remove duplicate components, however this is unnecessary as the `load_component` method immediately returns dups.  Using a list should preserve the load order based on the configuration, making it more predictable.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-11-03 08:08:28 -04:00 committed by Eric Callahan
parent 76731b673b
commit c718e9d1c3
1 changed files with 7 additions and 4 deletions

View File

@ -211,14 +211,17 @@ class Server:
self.set_failed_component(name) self.set_failed_component(name)
def _load_components(self, config: confighelper.ConfigHelper) -> None: def _load_components(self, config: confighelper.ConfigHelper) -> None:
cfg_sections = [s.split()[0] for s in config.sections()]
cfg_sections.remove('server')
# load core components # load core components
for component in CORE_COMPONENTS: for component in CORE_COMPONENTS:
self.load_component(config, component) self.load_component(config, component)
if component in cfg_sections:
cfg_sections.remove(component)
# check for optional components # load remaining optional components
opt_sections = set([s.split()[0] for s in config.sections()]) for section in cfg_sections:
opt_sections.remove('server')
for section in opt_sections:
self.load_component(config, section, None) self.load_component(config, section, None)
def load_component(self, def load_component(self,