Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/config_hotreload #142

Merged
merged 1 commit into from Jun 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions mycroft/configuration/config.py
Expand Up @@ -424,11 +424,27 @@ def _on_file_change(path):
# reload updated config
for cfg in Configuration.xdg_configs + [Configuration.system]:
if cfg.path == path:
cfg.reload()
try:
cfg.reload()
except:
# got the file changed signal before write finished
sleep(0.5)
try:
cfg.reload()
except:
LOG.exception("Failed to load configuration, syntax seems invalid!")
break
else:
# reload all configs
Configuration.reload()
try:
Configuration.reload()
except:
# got the file changed signal before write finished
sleep(0.5)
try:
Configuration.reload()
except:
LOG.exception("Failed to load configuration, syntax seems invalid!")

for handler in Configuration._callbacks:
try:
Expand Down