You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reset() calls disconnect() before releasing the connection back to the pool
disconnect() causes the underlying TCP socket to get disconnected
the next time the connection is handed out from the ConnectionPool it has to reconnect (avoiding this is the main reason for using a ConnectionPool in the first place)
The documentation states:
When you’re finished with a PubSub object, call its .close() method to shutdown the connection.
(and there are various other places that will call it anyway, eg PubSub.__del__, PubSubWorkerThread.run)
There appears to be no other way to release the connection back to the ConnectionPool (and even if you don't call PubSub.close(), PubSub.__del__() will invoke it at some point anyway). Simply commenting out the disconnect() causes other errors, it looks like the "unsubscribe" acknowledgement is not consumed but I only did a quick test.
Is this an oversight or is there some limitation of PubSub that means it must reset the TCP connection?
The text was updated successfully, but these errors were encountered:
@levic Hey! Sorry for the late response, the reason why we decided to explicitly close the connection before the release is a client buffer on server-side, Pub/Sub is a long-running thing so buffer is usually quite heavy and to be able to fully close the context of this connection and trigger server to flush a buffer we have to disconnect
I was wondering why my redis server showed more connect/disconnects than I expected when using PubSub
pubsub = connection.pubsub()
pubsub.close()
The documentation states:
(and there are various other places that will call it anyway, eg
PubSub.__del__
,PubSubWorkerThread.run
)There appears to be no other way to release the connection back to the ConnectionPool (and even if you don't call
PubSub.close()
,PubSub.__del__()
will invoke it at some point anyway). Simply commenting out the disconnect() causes other errors, it looks like the "unsubscribe" acknowledgement is not consumed but I only did a quick test.Is this an oversight or is there some limitation of PubSub that means it must reset the TCP connection?
The text was updated successfully, but these errors were encountered: