File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ def __init__(
4949 if isinstance (config_path , pathlib .Path )
5050 else pathlib .Path (config_path )
5151 )
52+ # FileWatcher can't watch for non-existing files, so we need to watch for the
53+ # parent directory instead just in case a configuration file doesn't exist yet
54+ # or it is deleted and recreated again.
5255 self ._file_watcher : FileWatcher = FileWatcher (
5356 paths = [self ._config_path .parent ], event_types = event_types
5457 )
@@ -82,6 +85,8 @@ async def run(self) -> None:
8285
8386 async for event in self ._file_watcher :
8487 if event .type != FileWatcher .EventType .DELETE :
88+ # Since we are watching the whole parent directory, we need to make sure
89+ # we only react to events related to the configuration file.
8590 if event .path == self ._config_path :
8691 _logger .info (
8792 "%s: Update configs, because file %s was modified." ,
You can’t perform that action at this time.
0 commit comments