goodvibs opened a new pull request, #297: URL: https://github.com/apache/pulsar-client-python/pull/297
# Summary Guard `_set_future` so scheduled completions are skipped when the `asyncio Future` is cancelled. # Problem `_set_future` schedules `complete()` via `call_soon_threadsafe`. If the `Future` is cancelled, a late callback could still call `set_result` / `set_exception`, which raises `asyncio.InvalidStateError` and is logged as an exception in the event loop callback. # Solution At the start of `complete()`, return early if `future.done()`. This matches common `asyncio` callback bridges (no-op when the future is no longer pending). # Testing Added `AsyncioSetFutureTest` with two cases (no live broker): cancelled `Future` + late success callback, and already-resolved `Future` + late callback. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
