Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to release connection from subscribe #122

Open
Jeffwhen opened this issue Jun 20, 2018 · 1 comment
Open

How to release connection from subscribe #122

Jeffwhen opened this issue Jun 20, 2018 · 1 comment

Comments

@Jeffwhen
Copy link

I am using sub/pub feature to do websocket communication. I find that a subscribe connection is never recycled, which lead to this NoAvailableConnectionsInPoolError error.

subscriber = await request.app.redis.start_subscribe()
subscriber.subscribe(['history'])
while True:
    # read reply and pass it to client
    pass

Should i manually release connection from subscribing, maybe?

@bcb
Copy link

bcb commented May 4, 2020

The connection pool isn't very useful in this library because there's no way to return a connection to the pool that I could see. connection.close() seems to reduce the poolsize which is not helpful. Also the pool is a list of connections, so if you say poolsize=1000 you have 1000 connections before even using one.

But I was able to get what I needed by using the Protocol functionality shown in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants