Add QUIT to the list of commands acceptable for PUBSUB channels #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a long-running Tornado server where I'd like to have a number of relatively short-lived Redis PUBSUB connections (one per HTTP client connection). To avoid this set of Redis connections growing indefinitely, I want to close them once the HTTP client disconnects. However, Toredis currently asserts that QUIT cannot (as a normal command) be run on PUBSUB connections.
This change adds QUIT to the whitelist of commands for PUBSUB connections. I've added a unit test for the behaviour (which fails as expected without the change to the whitelist), and it appears to work as desired in my application. I can't see anything in the Redis documentation that says QUIT can't be used on PUBSUB channels; however, if I'm missing some subtlety let me know and I'll investigate further.