Engine timings move to FLOW_* settings

NODE_STOP_TIMEOUT, REBUILD_WAIT, FLOW_REBUILD_WAIT, BACKOFF and
CANCEL_GRACE keep their defaults and are read from Settings.
This commit is contained in:
2026-10-15 09:50:18 +02:00
parent 1f213460ad
commit 9a029a85f8
5 changed files with 39 additions and 5 deletions
+3 -3
View File
@@ -106,7 +106,7 @@ def _is_hook(node: Node | None) -> TypeGuard[HttpNode | WebSocketNode]:
# A node's `stop` talks to whatever it connected to, and a broker that has gone
# away can leave it waiting for an acknowledgement that never arrives — which
# used to hold the rebuild, and everything queued behind it, forever.
NODE_STOP_TIMEOUT = 5.0
NODE_STOP_TIMEOUT = settings.FLOW_NODE_STOP_TIMEOUT
# How long a rebuild asked for by a request waits for one already running.
# Generous on purpose: a rebuild of a populated instance reconnects every
@@ -114,14 +114,14 @@ NODE_STOP_TIMEOUT = 5.0
# healthy one of those should not be turned away. Past that the controller is
# wedged rather than busy, and an error the caller can act on beats a request
# that never ends.
REBUILD_WAIT = 15.0
REBUILD_WAIT = settings.FLOW_PIPELINE_REBUILD_WAIT
# How long a caller waits for a *flow* rebuild that is already running. A
# per-flow rebuild reconnects one flow's nodes rather than the instance's,
# so this is a queueing budget — several of them back to back, which is what
# seeding does — not the room a single one needs. Fifteen seconds was sized for
# the whole-pipeline rebuild and would let a wedge sit unreported.
FLOW_REBUILD_WAIT = 5.0
FLOW_REBUILD_WAIT = settings.FLOW_REBUILD_WAIT
# How long a node has to have been down before it is shown as down. A device
# that misses one poll and comes back is a flake, not a fault, and without this
+3 -2
View File
@@ -26,11 +26,12 @@ from collections import deque
from collections.abc import Callable, Coroutine
from typing import Any
from fluksio.core.config import settings
from fluksio.flow.events import EventBus
logger = logging.getLogger(__name__)
BACKOFF = (1.0, 5.0, 30.0, 60.0)
BACKOFF = settings.FLOW_RESTART_BACKOFF
# A task that burns through this many restarts in the window is not going to
# recover by being restarted again *now*.
#
@@ -49,7 +50,7 @@ QUARANTINE_BACKOFF = (300.0, 900.0, 3600.0)
# this is not going to stop on its own — a client closing a socket the broker
# no longer answers on is the case seen in the wild — and the rebuild asking
# for it must not wait on that forever.
CANCEL_GRACE = 5.0
CANCEL_GRACE = settings.FLOW_CANCEL_GRACE
TaskFactory = Callable[[], Coroutine[Any, Any, None]]