Skip to content

Commit

Permalink
Better config.use_client_provided_uniq_id deprecation (#27)
Browse files Browse the repository at this point in the history
Moving this warning to the invocation of `GraphQL::AnyCable.use` makes
it issuable outside of Rails.
  • Loading branch information
gsamokovarov authored and Envek committed Oct 26, 2022
1 parent 0cff4fb commit 674a461
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 6 additions & 0 deletions lib/graphql-anycable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
module GraphQL
module AnyCable
def self.use(schema, **options)
if config.use_client_provided_uniq_id?
warn "[Deprecated] Using client provided channel uniq IDs could lead to unexpected behaviour, " \
"please, set GraphQL::AnyCable.config.use_client_provided_uniq_id = false or GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID=false, " \
"and update the `#unsubscribed` callback code according to the latest docs."
end

schema.use GraphQL::Subscriptions::AnyCableSubscriptions, **options
end

Expand Down
8 changes: 0 additions & 8 deletions lib/graphql/anycable/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ class Railtie < ::Rails::Railtie
path = File.expand_path(__dir__)
Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
end

config.after_initialize do
if GraphQL::AnyCable.config.use_client_provided_uniq_id?
warn "[Deprecated] Using client provided channel uniq IDs could lead to unexpected behaviour, " \
"please, set GraphQL::AnyCable.config.use_client_provided_uniq_id = false or GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID=false, " \
"and update the `#unsubscribed` callback code according to the latest docs."
end
end
end
end
end

0 comments on commit 674a461

Please sign in to comment.