-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delay the deprecation warning of use_client_provided_uniq_id
#26
Delay the deprecation warning of use_client_provided_uniq_id
#26
Conversation
When setting the `use_client_provided_uniq_id` to false through Ruby configuration code the deprecation warning was still issued: ```ruby GraphQL::AnyCable.config.use_client_provided_uniq_id = false # or... GraphQL::AnyCable.configure do |config| config.use_client_provided_uniq_id = false end ``` This happened because the deprecation warning was issued through an `on_load` callback that is invoked when the `GraphQL::AnyCable.config` is initialised. At that time, Anyway is getting settings through sources like ENV variables, but the Ruby configuration code is invoked **afterwards**. At Dext we prefer having this setting in Ruby code, not in an ENV or a YAML setting file.
Thanks for the report and for the solution. However, non-Rails users won't get deprecation warning then… 🤔 @palkan, what would be a correct way to resolve this for both Rails and non-Rails users? |
I did a quickfix here. 😅 A general fix for this should live in |
Maybe we can move deprecation into the graphql-anycable/lib/graphql-anycable.rb Line 13 in 736501c
This method is expected to be called after application configuration.
Yeah, that's a good idea! Thanks! I think, we can actually make it possible to pass a block to |
Thanks for the suggestions of issuing the deprecation in the How do you want proceed with this change? Do you folks prefer to solve the problem at its core or are you fine with moving the deprecation and fixing |
I think, we should merge the current version; it's better to handle this in this lib than to depend on third-parties. |
When setting the `use_client_provided_uniq_id` to false through Ruby configuration code the deprecation warning was still issued: ```ruby GraphQL::AnyCable.config.use_client_provided_uniq_id = false # or... GraphQL::AnyCable.configure do |config| config.use_client_provided_uniq_id = false end ``` This happened because the deprecation warning was issued through an `on_load` callback that is invoked when the `GraphQL::AnyCable.config` is initialised. At that time, Anyway is getting settings through sources like ENV variables, but the Ruby configuration code is invoked **afterwards**. But we prefer having this setting in Ruby code, not in an ENV or a YAML setting file.
Released in 1.1.4. Thanks for the pull request! |
Thank you for the release and sorry to bring it back up. I thought I have applied Vlad's suggestion in this PR, but I have forgotten to push it. I have done it in another PR, if you want to decouple this warning from rails: #27. |
…dling * master: Switch to RubyGems Trusted publishing in CI release workflow [ci skip] add emergency actions TO README fix: consider redis_prefix in GraphQL::AnyCable::Cleaner add ability to set scan_count and added a little refactoring ability to fetch subscription stats use "around" instead "before" little refactoring add changes to README remove override redis_prefix and add an extra spec feat: Add configurable graphql redis_prefix Support empty operation name with redis.rb v5 (#34) Use arrays to fix deprecation warnings with redis gem 4.8 (#29) Use real Redis in tests instead of fakeredis gem (#32) Better `config.use_client_provided_uniq_id` deprecation (#27) Delay the deprecation warning of use_client_provided_uniq_id (#26)
When setting the
use_client_provided_uniq_id
tofalse
through Ruby configuration code the deprecation warning was still issued in our project:This happened because the deprecation warning was issued through an
on_load
callback that is invoked when theGraphQL::AnyCable.config
is initialised. At that time, Anyway is getting settings through sources like ENV variables, but the Ruby configuration code is invoked afterwards. At Dext we prefer having this setting in Ruby code.This solution delays the deprecation warning until the Rails application is initialized.