diff --git a/hbd/server/http.py b/hbd/server/http.py index f5ca967..f70137b 100644 --- a/hbd/server/http.py +++ b/hbd/server/http.py @@ -851,8 +851,7 @@ async def start( site = web.TCPSite(runner, host, port) await site.start() - if verbose: - print(f"HTTP server started on {host}:{port}") + logger.info(f"HTTP server started on {host}:{port}") try: await asyncio.Future() diff --git a/hbd/server/main.py b/hbd/server/main.py index 0267bfb..f819d82 100644 --- a/hbd/server/main.py +++ b/hbd/server/main.py @@ -130,6 +130,10 @@ async def reload_configuration(config_obj, config_path, components): async def _run_async(config, config_path=None): + from .config import ReloadableConfig + if not isinstance(config, ReloadableConfig): + config = ReloadableConfig(config, config_path) + loop = asyncio.get_running_loop() shutdown_event = asyncio.Event() reload_event = asyncio.Event() diff --git a/hbd/server/udp.py b/hbd/server/udp.py index 49dc045..11cd7af 100644 --- a/hbd/server/udp.py +++ b/hbd/server/udp.py @@ -233,11 +233,15 @@ def restore_connection_timers(hbdclass, ctx): if state == hbdclass.Connection.UP and interval > 0: elapsed = now - conn.lastbeat - remaining = max(1.0, (interval + grace) - elapsed) + # Give hosts one full (interval + grace) of extra time on startup + # so hosts that were silent while hbd was down are not immediately + # flagged as overdue before they have a chance to check in. + startup_grace = interval + grace + remaining = max(startup_grace, 2 * startup_grace - elapsed) conn.reset_overdue_timer(remaining, on_overdue) logger.debug( - "Restored UP timer %s/%s: %.0fs remaining (elapsed %.0fs)", - uname, afam, remaining, elapsed, + "Restored UP timer %s/%s: %.0fs remaining (elapsed %.0fs, startup grace %.0fs)", + uname, afam, remaining, elapsed, startup_grace, ) restored += 1