graphql-anycable 1.1.0 → 1.1.1
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/.github/workflows/test.yml +5 -21
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -0
- data/graphql-anycable.gemspec +3 -0
- data/lib/graphql/anycable/version.rb +1 -1
- data/lib/graphql/subscriptions/anycable_subscriptions.rb +22 -1
- metadata +44 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0437da8b1214b8c5aa81733cd8b0b4449a527f9d7f487e3d0e97034ffefea2e
|
|
4
|
+
data.tar.gz: ef6d5a734dfc73824e2a37e7b3d3bcd47eb3af597b99a9d91a7aa41c7fc85797
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eae7c1026142f0d4360d556af37eeae4937e9cde79bf0e05a8aed6a3dac9e40a6445f7970b11bc9c8a25def13ee42d1c0507452d6c168805452dc9a7d8fb1c30
|
|
7
|
+
data.tar.gz: f2985e19bad56f101099ca1da605f0eb62b606034d595530c86bbd672b146b65ef7f54212813fdf110dba961dfaa14e400bab390505828b4a8dc7fa289039155
|
data/.github/workflows/test.yml
CHANGED
|
@@ -10,7 +10,7 @@ on:
|
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
12
|
test:
|
|
13
|
-
name: "GraphQL-Ruby ${{ matrix.graphql }} (interpreter: ${{ matrix.interpreter }}
|
|
13
|
+
name: "GraphQL-Ruby ${{ matrix.graphql }} (interpreter: ${{ matrix.interpreter }} with AnyCable ${{ matrix.anycable }}, use_client_id: ${{ matrix.client_id }}) on Ruby ${{ matrix.ruby }}"
|
|
14
14
|
runs-on: ubuntu-latest
|
|
15
15
|
strategy:
|
|
16
16
|
fail-fast: false
|
|
@@ -19,34 +19,17 @@ jobs:
|
|
|
19
19
|
- ruby: "3.0"
|
|
20
20
|
graphql: '~> 1.12.0'
|
|
21
21
|
anycable: '~> 1.1.0'
|
|
22
|
+
client_id: 'false'
|
|
22
23
|
interpreter: yes
|
|
23
|
-
- ruby: "3.0"
|
|
24
|
-
graphql: '~> 1.12.0'
|
|
25
|
-
anycable: '~> 1.1.0'
|
|
26
|
-
interpreter: no
|
|
27
24
|
- ruby: 2.7
|
|
28
25
|
graphql: '~> 1.12.0'
|
|
29
26
|
anycable: '~> 1.1.0'
|
|
30
|
-
|
|
31
|
-
- ruby: 2.7
|
|
32
|
-
graphql: '~> 1.12.0'
|
|
33
|
-
anycable: '~> 1.1.0'
|
|
34
|
-
interpreter: no
|
|
35
|
-
- ruby: 2.6
|
|
36
|
-
graphql: '~> 1.11.0'
|
|
37
|
-
anycable: '~> 1.0.0'
|
|
27
|
+
client_id: 'false'
|
|
38
28
|
interpreter: yes
|
|
39
29
|
- ruby: 2.6
|
|
40
30
|
graphql: '~> 1.11.0'
|
|
41
31
|
anycable: '~> 1.0.0'
|
|
42
|
-
|
|
43
|
-
- ruby: 2.5
|
|
44
|
-
graphql: '~> 1.11.0'
|
|
45
|
-
anycable: '~> 1.0.0'
|
|
46
|
-
interpreter: yes
|
|
47
|
-
- ruby: 2.5
|
|
48
|
-
graphql: '~> 1.11.0'
|
|
49
|
-
anycable: '~> 1.0.0'
|
|
32
|
+
client_id: 'true'
|
|
50
33
|
interpreter: no
|
|
51
34
|
container:
|
|
52
35
|
image: ruby:${{ matrix.ruby }}
|
|
@@ -54,6 +37,7 @@ jobs:
|
|
|
54
37
|
CI: true
|
|
55
38
|
GRAPHQL_RUBY_VERSION: ${{ matrix.graphql }}
|
|
56
39
|
ANYCABLE_VERSION: ${{ matrix.anycable }}
|
|
40
|
+
GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID: ${{ matrix.client_id }}
|
|
57
41
|
steps:
|
|
58
42
|
- uses: actions/checkout@v2
|
|
59
43
|
- uses: actions/cache@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.1 - 2021-12-06
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Handling of buggy istate values on unsubscribe (when `use_client_provided_uniq_id: false`). [@palkan] [#20](https://github.com/anycable/graphql-anycable/pull/20)
|
|
15
|
+
- A bug when `#unsubscribe` happens before `#execute`. [@palkan] [#20](https://github.com/anycable/graphql-anycable/pull/20)
|
|
16
|
+
|
|
10
17
|
## 1.1.0 - 2021-11-17
|
|
11
18
|
|
|
12
19
|
### Added
|
|
@@ -142,3 +149,4 @@ Initial version: store subscriptions on redis, re-execute queries in sync. [@Env
|
|
|
142
149
|
[@bibendi]: https://github.com/bibendi "Misha Merkushin"
|
|
143
150
|
[@FX-HAO]: https://github.com/FX-HAO "Fuxin Hao"
|
|
144
151
|
[@Envek]: https://github.com/Envek "Andrey Novikov"
|
|
152
|
+
[@palkan]: https://github.com/palkan "Vladimir Dementyev"
|
data/Gemfile
CHANGED
data/graphql-anycable.gemspec
CHANGED
|
@@ -31,8 +31,11 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency "graphql", "~> 1.11"
|
|
32
32
|
spec.add_dependency "redis", ">= 4.2.0"
|
|
33
33
|
|
|
34
|
+
spec.add_development_dependency "anycable-rails"
|
|
34
35
|
spec.add_development_dependency "bundler", "~> 2.0"
|
|
35
36
|
spec.add_development_dependency "fakeredis"
|
|
37
|
+
spec.add_development_dependency "rack"
|
|
38
|
+
spec.add_development_dependency "railties"
|
|
36
39
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
|
37
40
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
38
41
|
end
|
|
@@ -225,6 +225,10 @@ module GraphQL
|
|
|
225
225
|
def delete_channel_subscriptions(channel_or_id)
|
|
226
226
|
# For backward compatibility
|
|
227
227
|
channel_id = channel_or_id.is_a?(String) ? channel_or_id : read_subscription_id(channel_or_id)
|
|
228
|
+
|
|
229
|
+
# Missing in case disconnect happens before #execute
|
|
230
|
+
return unless channel_id
|
|
231
|
+
|
|
228
232
|
redis.smembers(CHANNEL_PREFIX + channel_id).each do |subscription_id|
|
|
229
233
|
delete_subscription(subscription_id)
|
|
230
234
|
end
|
|
@@ -240,13 +244,30 @@ module GraphQL
|
|
|
240
244
|
def read_subscription_id(channel)
|
|
241
245
|
return channel.instance_variable_get(:@__sid__) if channel.instance_variable_defined?(:@__sid__)
|
|
242
246
|
|
|
243
|
-
|
|
247
|
+
istate = fetch_channel_istate(channel)
|
|
248
|
+
|
|
249
|
+
return unless istate
|
|
250
|
+
|
|
251
|
+
channel.instance_variable_set(:@__sid__, istate["sid"])
|
|
244
252
|
end
|
|
245
253
|
|
|
246
254
|
def write_subscription_id(channel, val)
|
|
247
255
|
channel.connection.socket.istate["sid"] = val
|
|
248
256
|
channel.instance_variable_set(:@__sid__, val)
|
|
249
257
|
end
|
|
258
|
+
|
|
259
|
+
def fetch_channel_istate(channel)
|
|
260
|
+
# For Rails integration
|
|
261
|
+
return channel.__istate__ if channel.respond_to?(:__istate__)
|
|
262
|
+
|
|
263
|
+
return unless channel.connection.socket.istate
|
|
264
|
+
|
|
265
|
+
if channel.connection.socket.istate[channel.identifier]
|
|
266
|
+
JSON.parse(channel.connection.socket.istate[channel.identifier])
|
|
267
|
+
else
|
|
268
|
+
channel.connection.socket.istate
|
|
269
|
+
end
|
|
270
|
+
end
|
|
250
271
|
end
|
|
251
272
|
end
|
|
252
273
|
end
|
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.
|
|
4
|
+
version: 1.1.1
|
|
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-
|
|
11
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: anycable
|
|
@@ -72,6 +72,20 @@ dependencies:
|
|
|
72
72
|
- - ">="
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
74
|
version: 4.2.0
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: anycable-rails
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
75
89
|
- !ruby/object:Gem::Dependency
|
|
76
90
|
name: bundler
|
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,6 +114,34 @@ dependencies:
|
|
|
100
114
|
- - ">="
|
|
101
115
|
- !ruby/object:Gem::Version
|
|
102
116
|
version: '0'
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: rack
|
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0'
|
|
124
|
+
type: :development
|
|
125
|
+
prerelease: false
|
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0'
|
|
131
|
+
- !ruby/object:Gem::Dependency
|
|
132
|
+
name: railties
|
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
138
|
+
type: :development
|
|
139
|
+
prerelease: false
|
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
103
145
|
- !ruby/object:Gem::Dependency
|
|
104
146
|
name: rake
|
|
105
147
|
requirement: !ruby/object:Gem::Requirement
|