pynats icon indicating copy to clipboard operation
pynats copied to clipboard

Error handing unsubscribed messages

Open Redundancy opened this issue 8 years ago • 1 comments

mySub1 = c.subscribe('foo', <callback>)
mySub2 = c.subscribe('foo', <callback>)
c.publish("foo", "1")
c.unsubscribe(mySub1)
c.publish("foo", "2")
c.wait(count=3)

Running this code will cause an exception in pynats, I'm guessing because of a race condition where the messages are already queued for delivery, but the subscription is removed (synchronously).

I believe that in this case, the Golang implementation handles the synchronous unsubscribe, and ignores any messages that come through for an unknown subscription.

Redundancy avatar Jul 27 '15 14:07 Redundancy