Grace interval on restart of hbd, fix SIGHUP processing

This commit is contained in:
Andreas Wrede
2026-04-10 12:58:38 -04:00
parent 3426185383
commit 2015195112
3 changed files with 12 additions and 5 deletions
+1 -2
View File
@@ -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()
+4
View File
@@ -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()
+7 -3
View File
@@ -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