async-redis 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/async/redis/client.rb +2 -1
- data/lib/async/redis/context/subscribe.rb +8 -28
- data/lib/async/redis/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b7fa7e90dde1de452fa42be8d82291110dc8106f859b2adbb71bde0b54a4e3
|
4
|
+
data.tar.gz: b79617b8dc5040fe52a6ff4cccac03472952177d9f05f4fa461db1d2d4dd21eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bf7f44736f2c8442d12fbab0031c6cfdf5274b9f56b215dbfc4e66c522eb876dc97e0cde60b09a342b144da2217cb9aeacde9dc0b868616fd94ca8de23c0fdb
|
7
|
+
data.tar.gz: 61d6e8ff6603fb31c86b8524b32b3877099f3a49c65614f9c2ac0f76137e8c1c486e1bd344e30dc039aee8d152842bab8bb6a5df26bc7bf09b9ae1ba663dd5ba
|
data/lib/async/redis/client.rb
CHANGED
@@ -131,7 +131,8 @@ module Async
|
|
131
131
|
Async::Pool::Controller.wrap(**options) do
|
132
132
|
peer = @endpoint.connect
|
133
133
|
|
134
|
-
|
134
|
+
# We will manage flushing ourselves:
|
135
|
+
peer.sync = true
|
135
136
|
|
136
137
|
stream = IO::Stream.new(peer)
|
137
138
|
|
@@ -27,11 +27,11 @@ module Async
|
|
27
27
|
module Redis
|
28
28
|
module Context
|
29
29
|
class Subscribe < Generic
|
30
|
+
MESSAGE = 'message'
|
31
|
+
|
30
32
|
def initialize(pool, channels)
|
31
33
|
super(pool)
|
32
34
|
|
33
|
-
@channels = channels
|
34
|
-
|
35
35
|
subscribe(channels)
|
36
36
|
end
|
37
37
|
|
@@ -43,39 +43,19 @@ module Async
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def listen
|
46
|
-
|
46
|
+
while response = @connection.read_response
|
47
|
+
return response if response.first == MESSAGE
|
48
|
+
end
|
47
49
|
end
|
48
50
|
|
49
|
-
private
|
50
|
-
|
51
51
|
def subscribe(channels)
|
52
52
|
@connection.write_request ['SUBSCRIBE', *channels]
|
53
53
|
@connection.flush
|
54
|
-
|
55
|
-
response = nil
|
56
|
-
|
57
|
-
channels.length.times do |i|
|
58
|
-
response = @connection.read_response
|
59
|
-
end
|
60
|
-
|
61
|
-
return response
|
62
54
|
end
|
63
55
|
|
64
|
-
def unsubscribe(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
response = nil
|
69
|
-
|
70
|
-
@channels.length.times do |i|
|
71
|
-
response = @connection.read_response
|
72
|
-
end
|
73
|
-
|
74
|
-
return response
|
75
|
-
else
|
76
|
-
@channels.subtract(channels)
|
77
|
-
return call('UNSUBSCRIBE', *channels)
|
78
|
-
end
|
56
|
+
def unsubscribe(channels)
|
57
|
+
@connection.write_request ['UNSUBSCRIBE', *channels]
|
58
|
+
@connection.flush
|
79
59
|
end
|
80
60
|
end
|
81
61
|
end
|
data/lib/async/redis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: async
|