pynats
pynats copied to clipboard
Error handing unsubscribed messages
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.