Skip to content

Commit a186c55

Browse files
committed
Fix deprecation warning on MultiJson#load/dump
These are [deprecated] in v1, renamed to `parse`/`generate` to match stdlib API, and will be removed in v2. Upstream que has [dropped] `multi_json` entirely, so this does not affect that transition. [deprecated]: https://github.com/sferik/multi_json/tree/v1.21.1#deprecated-in-1210 [dropped]: que-rb/que@bdd3c3d
1 parent 342d021 commit a186c55

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ group :development, :test do
1010
gem 'activerecord', require: nil
1111
gem 'connection_pool', require: nil
1212
gem 'gc_ruboconfig'
13+
gem 'multi_json', '~> 1.21', require: nil
1314
gem 'pg', require: nil, platform: :ruby
1415
gem 'pg_jruby', require: nil, platform: :jruby
1516
gem 'pond', require: nil

lib/que/adapters/base.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Base
3131
# integer
3232
23 => proc(&:to_i),
3333
# json
34-
114 => ->(value) { JSON_MODULE.load(value, create_additions: false) },
34+
114 => ->(value) { JSON_MODULE.parse(value, create_additions: false) },
3535
# float
3636
701 => proc(&:to_f),
3737
# timestamp with time zone
@@ -74,7 +74,7 @@ def execute(command, params = [])
7474
# The pg gem unfortunately doesn't convert fractions of time instances, so cast
7575
# them to a string.
7676
when Time then param.strftime("%Y-%m-%d %H:%M:%S.%6N %z")
77-
when Array, Hash then JSON_MODULE.dump(param)
77+
when Array, Hash then JSON_MODULE.generate(param)
7878
else param
7979
end
8080
end

0 commit comments

Comments
 (0)