mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 21:02:12 +02:00
Subscriber resilience: recreate consumer after connection failure
Move consumer creation from Subscriber.start() into the run() loop, matching the pattern used by Consumer. If the connection drops and the consumer is closed in the finally block, the loop now recreates it on the next iteration instead of spinning forever on a None consumer. Previously, start() created the consumer once and run() assumed it existed for the lifetime of the subscriber. A connection failure would set self.consumer = None in the finally cleanup, and the outer retry loop would re-enter with no consumer, causing an infinite 'NoneType has no attribute receive' error loop.
This commit is contained in:
parent
ddd4bd7790
commit
34d87727fc
3 changed files with 22 additions and 30 deletions
|
|
@ -294,9 +294,8 @@ class TestPollTimeout:
|
|||
raise type('Timeout', (Exception,), {})("timeout")
|
||||
|
||||
mock_pulsar_consumer.receive = capture_receive
|
||||
consumer.consumer = mock_pulsar_consumer
|
||||
|
||||
await consumer.consume_from_queue()
|
||||
await consumer.consume_from_queue(mock_pulsar_consumer)
|
||||
|
||||
assert received_kwargs.get("timeout_millis") == 100
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue