You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,6 +131,13 @@ To avoid filling Redis storage with stale subscription data:
131
131
132
132
Heroku users should set up `use_redis_object_on_cleanup` setting to `false` due to [limitations in Heroku Redis](https://devcenter.heroku.com/articles/heroku-redis#connection-permissions).
133
133
134
+
### Limitations
135
+
136
+
The `GraphQL::AnyCable::Cleaner` uses [IDLETIME](https://redis.io/commands/object-idletime/) for detecting how long the object was inactive.
137
+
It is a good way to detect inactive subscriptions, but `IDLETIME` is updated every time, not only when new subscriptions are, but when we read it
138
+
It means that `broadcasting` also updates the `IDLETIME`, which does not give us the ability to detect useless subscriptions for cleaning
139
+
It will be resolved in the next versions
140
+
134
141
## Configuration
135
142
136
143
GraphQL-AnyCable uses [anyway_config] to configure itself. There are several possibilities to configure this gem:
@@ -166,6 +173,21 @@ GraphQL-AnyCable uses [anyway_config] to configure itself. There are several pos
166
173
167
174
And any other way provided by [anyway_config]. Check its documentation!
168
175
176
+
## Emergency Actions
177
+
178
+
In situations, when you don't set `subscription_expiration_seconds`, have a lot of inactive subscriptions and`GraphQL::AnyCable::Cleaner` doesn`t help in that, you can do the
179
+
next actions for clearing subscriptions
180
+
181
+
1. Set `config.subscription_expiration_seconds`. After that, the new subscriptions will have `TTL`
182
+
2. Through the `redis_prefix` (look at the `Configuration` block) change the redis prefixes, which uses for storing keys
183
+
3. Run the script, using the old `redis_prefix` (the default value is `graphql`)
184
+
```ruby
185
+
redis =GraphQL::AnyCable.redis
186
+
redis.scan_each("graphql-subscription:*") do |key|
187
+
redis.del(key) if redis.ttl(key) <0# Remove it, because it is an old record
188
+
end
189
+
```
190
+
169
191
## Data model
170
192
171
193
As in AnyCable there is no place to store subscription data in-memory, it should be persisted somewhere to be retrieved on `GraphQLSchema.subscriptions.trigger` and sent to subscribed clients. `graphql-anycable` uses the same Redis database as AnyCable itself.
0 commit comments