graphql-anycable 1.1.1 → 1.1.2

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: a0437da8b1214b8c5aa81733cd8b0b4449a527f9d7f487e3d0e97034ffefea2e
4
- data.tar.gz: ef6d5a734dfc73824e2a37e7b3d3bcd47eb3af597b99a9d91a7aa41c7fc85797
3
+ metadata.gz: 4eb249dbc6328d60349c77133acf85310aed8327970a566a29948150e273ccd4
4
+ data.tar.gz: 63ed46c57e0edcaab0070bc76b7302d132c08e66d82e4df50952eea179df1d46
5
5
  SHA512:
6
- metadata.gz: eae7c1026142f0d4360d556af37eeae4937e9cde79bf0e05a8aed6a3dac9e40a6445f7970b11bc9c8a25def13ee42d1c0507452d6c168805452dc9a7d8fb1c30
7
- data.tar.gz: f2985e19bad56f101099ca1da605f0eb62b606034d595530c86bbd672b146b65ef7f54212813fdf110dba961dfaa14e400bab390505828b4a8dc7fa289039155
6
+ metadata.gz: eaf554708a593aba20f54f3fe02f8cb841253e61a2485da7761d7ac68a33f0f154bee17c8f9642697692e26d98a603e507ae48da847a7303809657a6c3f8bdad
7
+ data.tar.gz: 4d48e480589166950e962f08f70ce38f0022a306608315ff1b3509f75211ef5902e9cafe803551cfd645fd55fc759057d3d6c0e0a4002a2a28850933a958a641
@@ -10,7 +10,7 @@ on:
10
10
 
11
11
  jobs:
12
12
  test:
13
- name: "GraphQL-Ruby ${{ matrix.graphql }} (interpreter: ${{ matrix.interpreter }} with AnyCable ${{ matrix.anycable }}, use_client_id: ${{ matrix.client_id }}) on Ruby ${{ matrix.ruby }}"
13
+ name: "GraphQL-Ruby ${{ matrix.graphql }} (interpreter: ${{ matrix.interpreter }}, use_client_id: ${{ matrix.client_id }}) on Ruby ${{ matrix.ruby }}"
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  fail-fast: false
@@ -18,25 +18,25 @@ jobs:
18
18
  include:
19
19
  - ruby: "3.0"
20
20
  graphql: '~> 1.12.0'
21
- anycable: '~> 1.1.0'
22
21
  client_id: 'false'
23
22
  interpreter: yes
23
+ anycable_rails: '~> 1.2'
24
24
  - ruby: 2.7
25
25
  graphql: '~> 1.12.0'
26
- anycable: '~> 1.1.0'
27
26
  client_id: 'false'
28
27
  interpreter: yes
28
+ anycable_rails: '~> 1.2.0'
29
29
  - ruby: 2.6
30
30
  graphql: '~> 1.11.0'
31
- anycable: '~> 1.0.0'
32
31
  client_id: 'true'
33
32
  interpreter: no
33
+ anycable_rails: '~> 1.0'
34
34
  container:
35
35
  image: ruby:${{ matrix.ruby }}
36
36
  env:
37
37
  CI: true
38
38
  GRAPHQL_RUBY_VERSION: ${{ matrix.graphql }}
39
- ANYCABLE_VERSION: ${{ matrix.anycable }}
39
+ ANYCABLE_RAILS_VERSION: ${{ matrix.anycable_rails }}
40
40
  GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID: ${{ matrix.client_id }}
41
41
  steps:
42
42
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 1.1.2 - 2022-03-11
11
+
12
+ ### Fixed
13
+
14
+ - AnyCable 1.3.0 compatibility. [@palkan] [#21](https://github.com/anycable/graphql-anycable/pull/21)
15
+ - Redis.rb 5.0 compatibility. [@palkan] [#21](https://github.com/anycable/graphql-anycable/pull/21)
16
+
10
17
  ## 1.1.1 - 2021-12-06
11
18
 
12
19
  ### Fixed
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gemspec
9
9
 
10
10
  gem "graphql", ENV.fetch("GRAPHQL_RUBY_VERSION", "~> 1.12")
11
11
  gem "anycable", ENV.fetch("ANYCABLE_VERSION", "~> 1.0")
12
- gem "anycable-rails", ENV.fetch("ANYCABLE_VERSION", "~> 1.0"), require: false
12
+ gem "anycable-rails", ENV.fetch("ANYCABLE_RAILS_VERSION", "~> 1.2")
13
13
 
14
14
  group :development, :test do
15
15
  gem "pry"
data/README.md CHANGED
@@ -144,7 +144,7 @@ GraphQL-AnyCable uses [anyway_config] to configure itself. There are several pos
144
144
  GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID=false
145
145
  ```
146
146
 
147
- 2. YAML configuration files:
147
+ 2. YAML configuration files (note that this is `config/graphql_anycable.yml`, *not* `config/anycable.yml`):
148
148
 
149
149
  ```yaml
150
150
  # config/graphql_anycable.yml
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module AnyCable
5
- VERSION = "1.1.1"
5
+ VERSION = "1.1.2"
6
6
  end
7
7
  end
@@ -79,9 +79,9 @@ module GraphQL
79
79
  return if fingerprints.empty?
80
80
 
81
81
  fingerprint_subscription_ids = Hash[fingerprints.zip(
82
- redis.pipelined do
82
+ redis.pipelined do |pipeline|
83
83
  fingerprints.map do |fingerprint|
84
- redis.smembers(SUBSCRIPTIONS_PREFIX + fingerprint)
84
+ pipeline.smembers(SUBSCRIPTIONS_PREFIX + fingerprint)
85
85
  end
86
86
  end
87
87
  )]
@@ -160,16 +160,16 @@ module GraphQL
160
160
  events: events.map { |e| [e.topic, e.fingerprint] }.to_h.to_json,
161
161
  }
162
162
 
163
- redis.multi do
164
- redis.sadd(CHANNEL_PREFIX + channel_uniq_id, subscription_id)
165
- redis.mapped_hmset(SUBSCRIPTION_PREFIX + subscription_id, data)
163
+ redis.multi do |pipeline|
164
+ pipeline.sadd(CHANNEL_PREFIX + channel_uniq_id, subscription_id)
165
+ pipeline.mapped_hmset(SUBSCRIPTION_PREFIX + subscription_id, data)
166
166
  events.each do |event|
167
- redis.zincrby(FINGERPRINTS_PREFIX + event.topic, 1, event.fingerprint)
168
- redis.sadd(SUBSCRIPTIONS_PREFIX + event.fingerprint, subscription_id)
167
+ pipeline.zincrby(FINGERPRINTS_PREFIX + event.topic, 1, event.fingerprint)
168
+ pipeline.sadd(SUBSCRIPTIONS_PREFIX + event.fingerprint, subscription_id)
169
169
  end
170
170
  next unless config.subscription_expiration_seconds
171
- redis.expire(CHANNEL_PREFIX + channel_uniq_id, config.subscription_expiration_seconds)
172
- redis.expire(SUBSCRIPTION_PREFIX + subscription_id, config.subscription_expiration_seconds)
171
+ pipeline.expire(CHANNEL_PREFIX + channel_uniq_id, config.subscription_expiration_seconds)
172
+ pipeline.expire(SUBSCRIPTION_PREFIX + subscription_id, config.subscription_expiration_seconds)
173
173
  end
174
174
  end
175
175
 
@@ -191,19 +191,19 @@ module GraphQL
191
191
  events = redis.hget(SUBSCRIPTION_PREFIX + subscription_id, :events)
192
192
  events = events ? JSON.parse(events) : {}
193
193
  fingerprint_subscriptions = {}
194
- redis.pipelined do
194
+ redis.pipelined do |pipeline|
195
195
  events.each do |topic, fingerprint|
196
- redis.srem(SUBSCRIPTIONS_PREFIX + fingerprint, subscription_id)
197
- score = redis.zincrby(FINGERPRINTS_PREFIX + topic, -1, fingerprint)
196
+ pipeline.srem(SUBSCRIPTIONS_PREFIX + fingerprint, subscription_id)
197
+ score = pipeline.zincrby(FINGERPRINTS_PREFIX + topic, -1, fingerprint)
198
198
  fingerprint_subscriptions[FINGERPRINTS_PREFIX + topic] = score
199
199
  end
200
200
  # Delete subscription itself
201
- redis.del(SUBSCRIPTION_PREFIX + subscription_id)
201
+ pipeline.del(SUBSCRIPTION_PREFIX + subscription_id)
202
202
  end
203
203
  # Clean up fingerprints that doesn't have any subscriptions left
204
- redis.pipelined do
204
+ redis.pipelined do |pipeline|
205
205
  fingerprint_subscriptions.each do |key, score|
206
- redis.zremrangebyscore(key, '-inf', '0') if score.value.zero?
206
+ pipeline.zremrangebyscore(key, '-inf', '0') if score.value.zero?
207
207
  end
208
208
  end
209
209
  delete_legacy_subscription(subscription_id)
@@ -252,7 +252,7 @@ module GraphQL
252
252
  end
253
253
 
254
254
  def write_subscription_id(channel, val)
255
- channel.connection.socket.istate["sid"] = val
255
+ channel.connection.anycable_socket.istate["sid"] = val
256
256
  channel.instance_variable_set(:@__sid__, val)
257
257
  end
258
258
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-anycable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-06 00:00:00.000000000 Z
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anycable