Skip to content

Commit

Permalink
Actively close the Redis connnection after stopping to listen for sub…
Browse files Browse the repository at this point in the history
…scriptions.

This quick fixes an issue where a final "unsubscribe" message isn't handled by the subscription code, but which is caught be the next regular command. This requires a second look at the protocol specification.
  • Loading branch information
s-ludwig committed Jul 28, 2014
1 parent 67f7308 commit eb3db4f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/vibe/db/redis/redis.d
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,15 @@ final class RedisSubscriber {
}
sw.stop();

if (!gotData) { m_listening = false; m_lockedConnection.destroy(); return; }
if (!gotData) {
m_listening = false;
// FIXME: it should be possible to avoid a disconnect, but
// obviously we are not waiting for an "unsubscribe"
// message after actively unsubscribing from all channels
m_lockedConnection.conn.close();
m_lockedConnection.destroy();
return;
}

if (m_capture !is null){
auto res = handler();
Expand Down

0 comments on commit eb3db4f

Please sign in to comment.