graphql-anycable 1.3.0 → 1.3.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eebb61e4181214e0f86bdf0cc33e7153e0a02c6c8de5e37996ca9457e6231385
|
4
|
+
data.tar.gz: 6fa0f37c132f8c22454bcdf9d995ac9b0c3f40c3913b0047f7be3b91eb68d07f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06b6b55507a369100a71e9a30b93cf0fccef1d82c948b71693e43a4629116749453577aa0919d5de12c3bad8f6703d9652b0378c6ad90c4775ab355fe9b4ce7d
|
7
|
+
data.tar.gz: d0ed4156e37e936fad396659517245b1f4540451e4b4012ec8d1478cc4c1b1d244c254b690b168f4d8d2d36a3aadf1c22643c5cde639b08c119c8ec801d97152
|
@@ -16,11 +16,13 @@ module GraphQL
|
|
16
16
|
return unless config.subscription_expiration_seconds
|
17
17
|
return unless config.use_redis_object_on_cleanup
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
AnyCable.with_redis do |redis|
|
20
|
+
redis.scan_each(match: "#{redis_key(adapter::CHANNEL_PREFIX)}*") do |key|
|
21
|
+
idle = redis.object("IDLETIME", key)
|
22
|
+
next if idle&.<= config.subscription_expiration_seconds
|
22
23
|
|
23
|
-
|
24
|
+
redis.del(key)
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
@@ -28,31 +30,37 @@ module GraphQL
|
|
28
30
|
return unless config.subscription_expiration_seconds
|
29
31
|
return unless config.use_redis_object_on_cleanup
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
AnyCable.with_redis do |redis|
|
34
|
+
redis.scan_each(match: "#{redis_key(adapter::SUBSCRIPTION_PREFIX)}*") do |key|
|
35
|
+
idle = redis.object("IDLETIME", key)
|
36
|
+
next if idle&.<= config.subscription_expiration_seconds
|
34
37
|
|
35
|
-
|
38
|
+
redis.del(key)
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
43
|
def clean_fingerprint_subscriptions
|
40
|
-
|
41
|
-
redis.
|
42
|
-
|
44
|
+
AnyCable.with_redis do |redis|
|
45
|
+
redis.scan_each(match: "#{redis_key(adapter::SUBSCRIPTIONS_PREFIX)}*") do |key|
|
46
|
+
redis.smembers(key).each do |subscription_id|
|
47
|
+
next if redis.exists?(redis_key(adapter::SUBSCRIPTION_PREFIX) + subscription_id)
|
43
48
|
|
44
|
-
|
49
|
+
redis.srem(key, subscription_id)
|
50
|
+
end
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
48
54
|
|
49
55
|
def clean_topic_fingerprints
|
50
|
-
|
51
|
-
redis.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
+
AnyCable.with_redis do |redis|
|
57
|
+
redis.scan_each(match: "#{redis_key(adapter::FINGERPRINTS_PREFIX)}*") do |key|
|
58
|
+
redis.zremrangebyscore(key, "-inf", "0")
|
59
|
+
redis.zrange(key, 0, -1).each do |fingerprint|
|
60
|
+
next if redis.exists?(redis_key(adapter::SUBSCRIPTIONS_PREFIX) + fingerprint)
|
61
|
+
|
62
|
+
redis.zrem(key, fingerprint)
|
63
|
+
end
|
56
64
|
end
|
57
65
|
end
|
58
66
|
end
|
@@ -63,10 +71,6 @@ module GraphQL
|
|
63
71
|
GraphQL::Subscriptions::AnyCableSubscriptions
|
64
72
|
end
|
65
73
|
|
66
|
-
def redis
|
67
|
-
GraphQL::AnyCable.redis
|
68
|
-
end
|
69
|
-
|
70
74
|
def config
|
71
75
|
GraphQL::AnyCable.config
|
72
76
|
end
|
@@ -5,7 +5,7 @@ require "graphql-anycable"
|
|
5
5
|
namespace :graphql do
|
6
6
|
namespace :anycable do
|
7
7
|
desc "Clean up stale graphql channels, subscriptions, and events from redis"
|
8
|
-
task clean: %i[clean:channels clean:subscriptions clean:
|
8
|
+
task clean: %i[clean:channels clean:subscriptions clean:fingerprint_subscriptions clean:topic_fingerprints]
|
9
9
|
|
10
10
|
namespace :clean do
|
11
11
|
# Clean up old channels
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anycable-core
|
@@ -162,7 +162,7 @@ dependencies:
|
|
162
162
|
- - "~>"
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '3.0'
|
165
|
-
description:
|
165
|
+
description:
|
166
166
|
email:
|
167
167
|
- envek@envek.name
|
168
168
|
executables: []
|
@@ -203,7 +203,7 @@ homepage: https://github.com/Envek/graphql-anycable
|
|
203
203
|
licenses:
|
204
204
|
- MIT
|
205
205
|
metadata: {}
|
206
|
-
post_install_message:
|
206
|
+
post_install_message:
|
207
207
|
rdoc_options: []
|
208
208
|
require_paths:
|
209
209
|
- lib
|
@@ -218,8 +218,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
- !ruby/object:Gem::Version
|
219
219
|
version: '0'
|
220
220
|
requirements: []
|
221
|
-
rubygems_version: 3.5.
|
222
|
-
signing_key:
|
221
|
+
rubygems_version: 3.5.22
|
222
|
+
signing_key:
|
223
223
|
specification_version: 4
|
224
224
|
summary: A drop-in replacement for GraphQL ActionCable subscriptions for AnyCable.
|
225
225
|
test_files: []
|