async-redis 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7796495846ed0704472b1daea7b68b6ef8eaab48b7fa7f70699603eb3b88f834
4
- data.tar.gz: cfbe584b55ddf465e4a013512003971df7c51ef8fe118b3843f1113d08bee7c4
3
+ metadata.gz: 96b7fa7e90dde1de452fa42be8d82291110dc8106f859b2adbb71bde0b54a4e3
4
+ data.tar.gz: b79617b8dc5040fe52a6ff4cccac03472952177d9f05f4fa461db1d2d4dd21eb
5
5
  SHA512:
6
- metadata.gz: 54523c3cb2c25376f46ce385c4bd2eb3a575993979810e4017b6e057de55811fb6d8c87d081f6677644307d967df5497415b8b155618def43d6eb7692c310ea1
7
- data.tar.gz: 2525dd0c0cd9eb602253513091ad68fe83350061ed1753fb70c28f9ac5dc75a627234837a2c5a2dc3fb5d7aa8d7331218f833d050c95d6329204c2663d9fa161
6
+ metadata.gz: 6bf7f44736f2c8442d12fbab0031c6cfdf5274b9f56b215dbfc4e66c522eb876dc97e0cde60b09a342b144da2217cb9aeacde9dc0b868616fd94ca8de23c0fdb
7
+ data.tar.gz: 61d6e8ff6603fb31c86b8524b32b3877099f3a49c65614f9c2ac0f76137e8c1c486e1bd344e30dc039aee8d152842bab8bb6a5df26bc7bf09b9ae1ba663dd5ba
@@ -131,7 +131,8 @@ module Async
131
131
  Async::Pool::Controller.wrap(**options) do
132
132
  peer = @endpoint.connect
133
133
 
134
- peer.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
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
- return @connection.read_response
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(*channels)
65
- if channels.empty? # unsubscribe from everything if no specific channels are given
66
- @connection.write_request ['UNSUBSCRIBE']
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
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Async
24
24
  module Redis
25
- VERSION = "0.5.2"
25
+ VERSION = "0.5.3"
26
26
  end
27
27
  end
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.2
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-11-17 00:00:00.000000000 Z
12
+ date: 2020-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: async