fix: salvage gateway dedup and executor cleanup from PR #993
Salvages the two still-relevant fixes from PR #993 onto current main: - use a 3-tuple LOCAL delivery key so explicit/local-origin targets are not duplicated - shut down the previous agent-loop ThreadPoolExecutor when resizing the global pool Adds regression tests for both behaviors.
This commit is contained in:
parent
429c44e377
commit
e5dc569daa
4 changed files with 32 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
"""Tests for the delivery routing module."""
|
||||
|
||||
from gateway.config import Platform, GatewayConfig, PlatformConfig, HomeChannel
|
||||
from gateway.delivery import DeliveryTarget, parse_deliver_spec
|
||||
from gateway.delivery import DeliveryRouter, DeliveryTarget, parse_deliver_spec
|
||||
from gateway.session import SessionSource
|
||||
|
||||
|
||||
|
|
@ -85,3 +85,12 @@ class TestTargetToStringRoundtrip:
|
|||
reparsed = DeliveryTarget.parse(s)
|
||||
assert reparsed.platform == Platform.TELEGRAM
|
||||
assert reparsed.chat_id == "999"
|
||||
|
||||
|
||||
class TestDeliveryRouter:
|
||||
def test_resolve_targets_does_not_duplicate_local_when_explicit(self):
|
||||
router = DeliveryRouter(GatewayConfig(always_log_local=True))
|
||||
|
||||
targets = router.resolve_targets(["local"])
|
||||
|
||||
assert [target.platform for target in targets] == [Platform.LOCAL]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue