file_manager: delay file observer initialization
The addition of "gcode file processors" makes it possible for processor registration to occur in "component_init". The file observer init must be delayed until after all processors are registered to correctly process metadata for gcode files added while Moonraker was not running. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
35cb7501c6
commit
c35353ed2a
@ -176,7 +176,7 @@ class FileManager:
|
||||
if prune:
|
||||
self.gcode_metadata.prune_storage()
|
||||
|
||||
async def component_init(self):
|
||||
def start_file_observer(self):
|
||||
self.fs_observer.initialize()
|
||||
|
||||
def _update_fixed_paths(self) -> None:
|
||||
@ -1889,6 +1889,8 @@ class InotifyObserver(BaseFileSystemObserver):
|
||||
self._notify_root_updated, mevts, root, root_path)
|
||||
|
||||
def initialize(self) -> None:
|
||||
if self.initialized:
|
||||
return
|
||||
for root, node in self.watched_roots.items():
|
||||
try:
|
||||
evts = node.scan_node()
|
||||
|
@ -195,6 +195,13 @@ class Server:
|
||||
if optional_comps:
|
||||
await asyncio.gather(*optional_comps)
|
||||
|
||||
# Wait until all components are initialized to start the file
|
||||
# observer. This allows other components to register gcode file
|
||||
# processors before metadata is processed for gcode files that
|
||||
# do not have a metadata entry.
|
||||
file_manager: FileManager = self.lookup_component("file_manager")
|
||||
file_manager.start_file_observer()
|
||||
|
||||
if not self.warnings:
|
||||
await self.event_loop.run_in_thread(self.config.create_backup)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user