async-redis 0.5.2 → 0.7.0

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: d8d65ffd87c3fc39ff159a221f15997ff90faa2935cc4f6b80c8d919a13ea909
4
+ data.tar.gz: 385cf65139987431ba3dd99ffbcec12cd27d07597363126eb4e3778f8101f862
5
5
  SHA512:
6
- metadata.gz: 54523c3cb2c25376f46ce385c4bd2eb3a575993979810e4017b6e057de55811fb6d8c87d081f6677644307d967df5497415b8b155618def43d6eb7692c310ea1
7
- data.tar.gz: 2525dd0c0cd9eb602253513091ad68fe83350061ed1753fb70c28f9ac5dc75a627234837a2c5a2dc3fb5d7aa8d7331218f833d050c95d6329204c2663d9fa161
6
+ metadata.gz: cd608d404017e9f11af979a5645da7428e12845e7b1e01e4726679600a7ada84eb2499fa71e7fd26d9eb314e1e92ed837381f8083b7ffb06ea2f34df24225051
7
+ data.tar.gz: 1b747b2123d64c0af6f63ed46e17e9bec20b32e415e847fd375fe5e22bd407855ff57cf72d76c896fe654c2f3400e2a38e47be5c1a0125722386faa1c1594176
@@ -44,7 +44,7 @@ module Async
44
44
  class Client
45
45
  include ::Protocol::Redis::Methods
46
46
 
47
- def initialize(endpoint = Redis.local_endpoint, protocol = Protocol::RESP2, **options)
47
+ def initialize(endpoint = Redis.local_endpoint, protocol: Protocol::RESP2, **options)
48
48
  @endpoint = endpoint
49
49
  @protocol = protocol
50
50
 
@@ -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
 
@@ -97,7 +97,7 @@ module Async
97
97
 
98
98
  def close
99
99
  flush
100
-
100
+ ensure
101
101
  super
102
102
  end
103
103
  end
@@ -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.7.0"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,30 +1,47 @@
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.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Huba Nagy
9
+ - David Ortiz
10
+ - Gleb Sinyavskiy
11
+ - Troex Nevelin
12
+ - Jeremy Jung
13
+ - Mika Hel
14
+ - Mikael Henriksson
15
+ - Olle Jonsson
16
+ - Salim Semaoune
17
+ - Tim Willard
18
+ - k1tsu
19
+ - machty
9
20
  autorequire:
10
21
  bindir: bin
11
22
  cert_chain: []
12
- date: 2020-11-17 00:00:00.000000000 Z
23
+ date: 2022-07-27 00:00:00.000000000 Z
13
24
  dependencies:
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: async
16
27
  requirement: !ruby/object:Gem::Requirement
17
28
  requirements:
18
- - - "~>"
29
+ - - ">="
19
30
  - !ruby/object:Gem::Version
20
31
  version: '1.8'
32
+ - - "<"
33
+ - !ruby/object:Gem::Version
34
+ version: '3.0'
21
35
  type: :runtime
22
36
  prerelease: false
23
37
  version_requirements: !ruby/object:Gem::Requirement
24
38
  requirements:
25
- - - "~>"
39
+ - - ">="
26
40
  - !ruby/object:Gem::Version
27
41
  version: '1.8'
42
+ - - "<"
43
+ - !ruby/object:Gem::Version
44
+ version: '3.0'
28
45
  - !ruby/object:Gem::Dependency
29
46
  name: async-io
30
47
  requirement: !ruby/object:Gem::Requirement
@@ -214,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
231
  - !ruby/object:Gem::Version
215
232
  version: '0'
216
233
  requirements: []
217
- rubygems_version: 3.1.2
234
+ rubygems_version: 3.3.7
218
235
  signing_key:
219
236
  specification_version: 4
220
237
  summary: A Redis client library.