graphql-anycable 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/graphql-anycable.gemspec +1 -1
- data/lib/graphql-anycable.rb +9 -2
- data/lib/graphql/anycable/cleaner.rb +3 -3
- data/lib/graphql/anycable/config.rb +1 -1
- data/lib/graphql/anycable/railtie.rb +1 -1
- data/lib/graphql/anycable/tasks/clean_expired_subscriptions.rake +3 -3
- data/lib/graphql/anycable/version.rb +2 -2
- data/lib/graphql/subscriptions/anycable_subscriptions.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c831aba1f67077cccb4ef5f1b7858715cf056e554551dab59acdf265a8c671e
|
4
|
+
data.tar.gz: 5049b208e8a02a2e110e698f5336a1314577d2e1f8a37742ce07807daac6e41a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9451177ced38d8f963fe8b7f4c5b8ae1933a1d9730403202ee0864f23b3649752e538f8e480aedcae042aac2958b60145dc1305b79e67a3e480a96279df2bb1
|
7
|
+
data.tar.gz: 1367ac8df59b0470725197da7be2701175cb8571146f81eaa896dd00b3052eee1f91e2abdabdf67bb5a18754385e11169d942864a65e1fb59cdb7f8afdd5938e
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ Or install it yourself as:
|
|
50
50
|
|
51
51
|
```ruby
|
52
52
|
class MySchema < GraphQL::Schema
|
53
|
-
use GraphQL::
|
53
|
+
use GraphQL::AnyCable
|
54
54
|
|
55
55
|
subscription SubscriptionType
|
56
56
|
end
|
@@ -111,7 +111,7 @@ To avoid filling Redis storage with stale subscription data:
|
|
111
111
|
|
112
112
|
## Configuration
|
113
113
|
|
114
|
-
GraphQL-
|
114
|
+
GraphQL-AnyCable uses [anyway_config] to configure itself. There are several possibilities to configure this gem:
|
115
115
|
|
116
116
|
1. Environment variables:
|
117
117
|
|
@@ -132,7 +132,7 @@ GraphQL-Anycable uses [anyway_config] to configure itself. There are several pos
|
|
132
132
|
3. Configuration from your application code:
|
133
133
|
|
134
134
|
```ruby
|
135
|
-
GraphQL::
|
135
|
+
GraphQL::AnyCable.configure do |config|
|
136
136
|
config.subscription_expiration_seconds = 3600 # 1 hour
|
137
137
|
end
|
138
138
|
```
|
data/graphql-anycable.gemspec
CHANGED
@@ -6,7 +6,7 @@ require "graphql/anycable/version"
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "graphql-anycable"
|
9
|
-
spec.version = GraphQL::
|
9
|
+
spec.version = GraphQL::AnyCable::VERSION
|
10
10
|
spec.authors = ["Andrey Novikov"]
|
11
11
|
spec.email = ["envek@envek.name"]
|
12
12
|
|
data/lib/graphql-anycable.rb
CHANGED
@@ -9,7 +9,11 @@ require_relative "graphql/anycable/railtie" if defined?(Rails)
|
|
9
9
|
require_relative "graphql/subscriptions/anycable_subscriptions"
|
10
10
|
|
11
11
|
module GraphQL
|
12
|
-
module
|
12
|
+
module AnyCable
|
13
|
+
def self.use(schema)
|
14
|
+
schema.use GraphQL::Subscriptions::AnyCableSubscriptions
|
15
|
+
end
|
16
|
+
|
13
17
|
module_function
|
14
18
|
|
15
19
|
def redis
|
@@ -24,7 +28,7 @@ module GraphQL
|
|
24
28
|
end
|
25
29
|
|
26
30
|
def config
|
27
|
-
@config ||= GraphQL::
|
31
|
+
@config ||= GraphQL::AnyCable::Config.new
|
28
32
|
end
|
29
33
|
|
30
34
|
def configure
|
@@ -32,3 +36,6 @@ module GraphQL
|
|
32
36
|
end
|
33
37
|
end
|
34
38
|
end
|
39
|
+
|
40
|
+
# For backward compatibility
|
41
|
+
GraphQL::Anycable = GraphQL::AnyCable
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module GraphQL
|
4
|
-
module
|
4
|
+
module AnyCable
|
5
5
|
module Cleaner
|
6
6
|
extend self
|
7
7
|
|
@@ -55,11 +55,11 @@ module GraphQL
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def redis
|
58
|
-
GraphQL::
|
58
|
+
GraphQL::AnyCable.redis
|
59
59
|
end
|
60
60
|
|
61
61
|
def config
|
62
|
-
GraphQL::
|
62
|
+
GraphQL::AnyCable.config
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -13,17 +13,17 @@ namespace :graphql do
|
|
13
13
|
namespace :clean do
|
14
14
|
# Clean up old channels
|
15
15
|
task :channels do
|
16
|
-
GraphQL::
|
16
|
+
GraphQL::AnyCable::Cleaner.clean_channels
|
17
17
|
end
|
18
18
|
|
19
19
|
# Clean up old subscriptions (they should have expired by themselves)
|
20
20
|
task :subscriptions do
|
21
|
-
GraphQL::
|
21
|
+
GraphQL::AnyCable::Cleaner.clean_subscriptions
|
22
22
|
end
|
23
23
|
|
24
24
|
# Clean up subscription_ids from events for expired subscriptions
|
25
25
|
task :events do
|
26
|
-
GraphQL::
|
26
|
+
GraphQL::AnyCable::Cleaner.clean_events
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -54,7 +54,7 @@ module GraphQL
|
|
54
54
|
class AnyCableSubscriptions < GraphQL::Subscriptions
|
55
55
|
extend Forwardable
|
56
56
|
|
57
|
-
def_delegators :"GraphQL::
|
57
|
+
def_delegators :"GraphQL::AnyCable", :redis, :config
|
58
58
|
|
59
59
|
SUBSCRIPTION_PREFIX = "graphql-subscription:"
|
60
60
|
SUBSCRIPTION_EVENTS_PREFIX = "graphql-subscription-events:"
|