fix: run full reload after HTTP config publish, not just config.reload()
HTTP config-mutating endpoints (publish, rollback, channel CRUD, user self-update) were calling config.reload() directly, which only refreshed the in-memory config dict. This skipped re-applying host.dyn/host.watched flags to live Host objects, so enabling dyndns via the UI had no effect until a SIGHUP was sent. Wire a reload_callback through http.start() that calls the same reload_configuration() function used by the SIGHUP handler, ensuring host attributes, notify module, users, and threshold checker are all updated on every config publish. Also fix unmatched quote in udp.py f-string log message. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+22
-9
@@ -264,6 +264,7 @@ async def start(
|
||||
get_now=None,
|
||||
VER="",
|
||||
threshold_checker=None,
|
||||
reload_callback=None,
|
||||
):
|
||||
"""Start an aiohttp web server and block until cancelled.
|
||||
|
||||
@@ -1319,9 +1320,11 @@ async def start(
|
||||
logger.error("Config write failed: %s", exc)
|
||||
return web.json_response({"error": str(exc)}, status=500)
|
||||
|
||||
if hasattr(config, "reload"):
|
||||
if reload_callback:
|
||||
await reload_callback()
|
||||
elif hasattr(config, "reload"):
|
||||
await config.reload()
|
||||
users_mod.load_users(config)
|
||||
users_mod.load_users(config)
|
||||
|
||||
return web.json_response({"ok": True})
|
||||
|
||||
@@ -1350,9 +1353,11 @@ async def start(
|
||||
logger.error("Rollback failed: %s", exc)
|
||||
return web.json_response({"error": str(exc)}, status=500)
|
||||
|
||||
if hasattr(config, "reload"):
|
||||
if reload_callback:
|
||||
await reload_callback()
|
||||
elif hasattr(config, "reload"):
|
||||
await config.reload()
|
||||
users_mod.load_users(config)
|
||||
users_mod.load_users(config)
|
||||
|
||||
return web.json_response({"ok": True})
|
||||
|
||||
@@ -1474,7 +1479,9 @@ async def start(
|
||||
logger.error("Channel create failed: %s", exc)
|
||||
return web.json_response({"error": str(exc)}, status=500)
|
||||
|
||||
if hasattr(config, "reload"):
|
||||
if reload_callback:
|
||||
await reload_callback()
|
||||
elif hasattr(config, "reload"):
|
||||
await config.reload()
|
||||
return web.json_response({"ok": True, "name": name})
|
||||
|
||||
@@ -1540,7 +1547,9 @@ async def start(
|
||||
logger.error("Channel update failed: %s", exc)
|
||||
return web.json_response({"error": str(exc)}, status=500)
|
||||
|
||||
if hasattr(config, "reload"):
|
||||
if reload_callback:
|
||||
await reload_callback()
|
||||
elif hasattr(config, "reload"):
|
||||
await config.reload()
|
||||
return web.json_response({"ok": True})
|
||||
|
||||
@@ -1572,7 +1581,9 @@ async def start(
|
||||
logger.error("Channel delete failed: %s", exc)
|
||||
return web.json_response({"error": str(exc)}, status=500)
|
||||
|
||||
if hasattr(config, "reload"):
|
||||
if reload_callback:
|
||||
await reload_callback()
|
||||
elif hasattr(config, "reload"):
|
||||
await config.reload()
|
||||
return web.json_response({"ok": True})
|
||||
|
||||
@@ -1631,9 +1642,11 @@ async def start(
|
||||
logger.error("User self-update failed: %s", exc)
|
||||
return web.json_response({"error": str(exc)}, status=500)
|
||||
|
||||
if hasattr(config, "reload"):
|
||||
if reload_callback:
|
||||
await reload_callback()
|
||||
elif hasattr(config, "reload"):
|
||||
await config.reload()
|
||||
users_mod.load_users(config)
|
||||
users_mod.load_users(config)
|
||||
|
||||
return web.json_response({"ok": True})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user