Drop global mutation of `_PROC_SPAWN_WAIT`

In top level `daemon`-fixture that is..

Use a local `bg_daemon_spawn_delay` instead of
mutating the module-level `_PROC_SPAWN_WAIT` —
previously each `daemon` fixture invocation would
permanently add 1.6s (UDS) or 1s (CI) to the
global, inflating delays across the session.

Also, emit a `test_log.warning()` when verbose
loglevel is silently reduced to `'info'`.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
subint_forkserver_backend
Gud Boi 2026-05-04 16:23:50 -04:00
parent 60ce713016
commit c4885f9d99
1 changed files with 10 additions and 5 deletions

View File

@ -254,6 +254,7 @@ def daemon(
tpt_proto: str,
ci_env: bool,
test_log: tractor.log.StackLevelAdapter,
# set_fork_aware_capture,
) -> subprocess.Popen:
'''
@ -261,8 +262,12 @@ def daemon(
"remote registrar" for discovery-protocol related tests.
'''
# XXX: too much logging will lock up the subproc (smh)
if loglevel in ('trace', 'debug'):
# XXX: too much logging will lock up the subproc (smh)
test_log.warning(
f'Test harness log level is too verbose: {loglevel!r}\n'
f'Reducing to INFO level..'
)
loglevel: str = 'info'
code: str = (
@ -300,19 +305,19 @@ def daemon(
# -[ ] UDS: can we do something similar for 'pinging" the
# file-socket?
#
global _PROC_SPAWN_WAIT
bg_daemon_spawn_delay: float = _PROC_SPAWN_WAIT
# UDS sockets are **really** fast to bind()/listen()/connect()
# so it's often required that we delay a bit more starting
# the first actor-tree..
if tpt_proto == 'uds':
_PROC_SPAWN_WAIT += 1.6
bg_daemon_spawn_delay += 1.6
if _non_linux and ci_env:
_PROC_SPAWN_WAIT += 1
bg_daemon_spawn_delay += 1
# XXX, allow time for the sub-py-proc to boot up.
# !TODO, see ping-polling ideas above!
time.sleep(_PROC_SPAWN_WAIT)
time.sleep(bg_daemon_spawn_delay)
assert not proc.returncode
yield proc