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) site = web.TCPSite(runner, host, port)
await site.start() await site.start()
if verbose: logger.info(f"HTTP server started on {host}:{port}")
print(f"HTTP server started on {host}:{port}")
try: try:
await asyncio.Future() 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): 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() loop = asyncio.get_running_loop()
shutdown_event = asyncio.Event() shutdown_event = asyncio.Event()
reload_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: if state == hbdclass.Connection.UP and interval > 0:
elapsed = now - conn.lastbeat 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) conn.reset_overdue_timer(remaining, on_overdue)
logger.debug( logger.debug(
"Restored UP timer %s/%s: %.0fs remaining (elapsed %.0fs)", "Restored UP timer %s/%s: %.0fs remaining (elapsed %.0fs, startup grace %.0fs)",
uname, afam, remaining, elapsed, uname, afam, remaining, elapsed, startup_grace,
) )
restored += 1 restored += 1