lib/async/redis/context/subscribe.rb in async-redis-0.5.0 vs lib/async/redis/context/subscribe.rb in async-redis-0.5.1
- old
+ new
@@ -33,10 +33,17 @@
@channels = channels
subscribe(channels)
end
+ def close
+ # There is no way to reset subscription state. On Redis v6+ you can use RESET, but this is not supported in <= v6.
+ @connection&.close
+
+ super
+ end
+
def listen
return @connection.read_response
end
private
@@ -65,10 +72,10 @@
end
return response
else
@channels.subtract(channels)
- return call 'UNSUBSCRIBE', *channels
+ return call('UNSUBSCRIBE', *channels)
end
end
end
end
end