Configurable heartbeat, test that a dead peer doesn't stop pings

This commit is contained in:
2026-08-16 14:47:47 +01:00
parent 38ef607506
commit bfc8d30eaa
3 changed files with 34 additions and 6 deletions
+1 -1
View File
@@ -235,7 +235,7 @@ hub = Hub()
async def heartbeat():
# proxies (cloudflare ~100s) drop idle websockets, keep every socket chatty
while True:
await asyncio.sleep(25)
await asyncio.sleep(config.HEARTBEAT_S)
try:
conns = [ws for group in hub.screens.values() for ws in group]
conns += [ws for group in hub.admins.values() for ws in group]
+2
View File
@@ -22,6 +22,8 @@ TOKEN_GRACE_MS = int(os.environ.get("TOKEN_GRACE_MS", "2500"))
ATTEMPT_SLACK_MS = int(os.environ.get("ATTEMPT_SLACK_MS", "8000"))
# once presence is proven, how long the voter has to type an access code
CODE_ENTRY_TTL_S = 180
# keepalive for websockets, proxies drop idle ones (cloudflare ~100s)
HEARTBEAT_S = float(os.environ.get("HEARTBEAT_S", "25"))
# codes needed to confirm each vote, 0 turns the check off
DEFAULT_VOTE_SCANS = 3