Fix misc bugs caught by Copilot review
Deats, - use `proc.poll() is None` in `sig_prog()` to distinguish "still running" from exit code 0; drop stale `breakpoint()` from fallback kill path (would hang CI). - add missing `raise` on the `RuntimeError` in `async_main()` when no tpt bind addrs given. - clean up stale uid entries from the registrar `_registry` when addr eviction empties the addr list. - update `discovery.__init__` docstring to match the new eager `._multiaddr` import. - fix `registar` -> `registrar` typo in teardown report log msg. Review: PR #429 (Copilot) https://github.com/goodboy/tractor/pull/429 (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codesubint_spawner_backend
parent
8817032c90
commit
ed65301d32
|
|
@ -212,7 +212,7 @@ def sig_prog(
|
|||
'''
|
||||
for i in range(tries):
|
||||
proc.send_signal(sig)
|
||||
if not proc.poll():
|
||||
if proc.poll() is None:
|
||||
print(
|
||||
f'WARNING, proc still alive after,\n'
|
||||
f'canc_timeout={canc_timeout!r}\n'
|
||||
|
|
@ -224,8 +224,7 @@ def sig_prog(
|
|||
else:
|
||||
# TODO: why sometimes does SIGINT not work on teardown?
|
||||
# seems to happen only when trace logging enabled?
|
||||
if not proc.poll():
|
||||
breakpoint()
|
||||
if proc.poll() is None:
|
||||
print(
|
||||
f'XXX WARNING KILLING PROG WITH SIGINT XXX\n'
|
||||
f'canc_timeout={canc_timeout!r}\n'
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@
|
|||
Discovery (protocols) API for automatic addressing
|
||||
and location management of (service) actors.
|
||||
|
||||
NOTE: to avoid circular imports, this ``__init__``
|
||||
does NOT eagerly import submodules. Use direct
|
||||
module paths like ``tractor.discovery._addr`` or
|
||||
``tractor.discovery._api`` instead.
|
||||
NOTE: this ``__init__`` only eagerly imports the
|
||||
``._multiaddr`` submodule (for public re-exports).
|
||||
Heavier submodules like ``._addr`` and ``._api``
|
||||
are NOT imported here to avoid circular imports;
|
||||
use direct module paths for those.
|
||||
|
||||
'''
|
||||
from ._multiaddr import (
|
||||
|
|
|
|||
|
|
@ -196,6 +196,8 @@ class Registrar(Actor):
|
|||
and addr_tup in other_addrs
|
||||
):
|
||||
other_addrs.remove(addr_tup)
|
||||
if not other_addrs:
|
||||
del self._registry[other_uid]
|
||||
break
|
||||
|
||||
# Append to this uid's addr list (avoid duplicates)
|
||||
|
|
|
|||
|
|
@ -1567,7 +1567,7 @@ async def async_main(
|
|||
# XXX, either passed in by caller or delivered
|
||||
# in post spawn-spec handshake for subs.
|
||||
if not accept_addrs:
|
||||
RuntimeError(
|
||||
raise RuntimeError(
|
||||
f'No tpt bind addresses provided to actor!?\n'
|
||||
f'parent_addr={parent_addr!r}\n'
|
||||
f'accept_addrs={accept_addrs!r}\n'
|
||||
|
|
@ -1926,7 +1926,7 @@ async def async_main(
|
|||
if failed_unreg:
|
||||
teardown_report += (
|
||||
f'-> Failed to unregister {actor.name} from '
|
||||
f'registar @ {addr}\n'
|
||||
f'registrar @ {addr}\n'
|
||||
)
|
||||
|
||||
# Ensure all peers (actors connected to us as clients) are finished
|
||||
|
|
|
|||
Loading…
Reference in New Issue