From 31ce6a330b22e4af23d2b0cf624bbc4ef495406b Mon Sep 17 00:00:00 2001 From: Chris Hanks Date: Tue, 6 Jun 2017 15:39:56 -0400 Subject: [PATCH 1/2] Drop support for MultiJson. --- CHANGELOG.md | 4 ++++ Gemfile | 1 - lib/que.rb | 9 +-------- lib/que/adapters/base.rb | 4 ++-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df72292f..a5aba341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### Unreleased +* Fix recurring JSON issues by dropping MultiJson support. + +### 0.12.3 (2017-06-01) + * JobTimeoutError < Interrupt, to avoid accidental rescuing * Change default queue from '' to 'default' * Expose `que_dead_tuples` metric diff --git a/Gemfile b/Gemfile index 089ab9f0..d031a83e 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,6 @@ group :development, :test do gem 'activerecord', require: nil gem 'connection_pool', require: nil gem 'gc_ruboconfig' - gem 'multi_json', '~> 1.21', require: nil gem 'pg', require: nil, platform: :ruby gem 'pg_jruby', require: nil, platform: :jruby gem 'pond', require: nil diff --git a/lib/que.rb b/lib/que.rb index 7c1bee80..439162bc 100644 --- a/lib/que.rb +++ b/lib/que.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "json" require "socket" # For hostname require_relative "que/adapters/base" @@ -17,14 +18,6 @@ require_relative "que/middleware/worker_health_check" module Que - begin - require "multi_json" - JSON_MODULE = MultiJson - rescue LoadError - require "json" - JSON_MODULE = JSON - end - HASH_DEFAULT_PROC = proc { |hash, key| hash[key.to_s] if key.is_a?(Symbol) } INDIFFERENTIATOR = proc do |object| diff --git a/lib/que/adapters/base.rb b/lib/que/adapters/base.rb index b6a6555b..570218fc 100644 --- a/lib/que/adapters/base.rb +++ b/lib/que/adapters/base.rb @@ -31,7 +31,7 @@ class Base # integer 23 => proc(&:to_i), # json - 114 => ->(value) { JSON_MODULE.parse(value, create_additions: false) }, + 114 => ->(value) { JSON.parse(value, create_additions: false) }, # float 701 => proc(&:to_f), # timestamp with time zone @@ -74,7 +74,7 @@ def execute(command, params = []) # The pg gem unfortunately doesn't convert fractions of time instances, so cast # them to a string. when Time then param.strftime("%Y-%m-%d %H:%M:%S.%6N %z") - when Array, Hash then JSON_MODULE.generate(param) + when Array, Hash then JSON.generate(param) else param end end From 3aaa5be53a3eac49de14bb987839d4ab099b3910 Mon Sep 17 00:00:00 2001 From: Oliver Ford Date: Tue, 21 Jul 2026 12:04:38 +0100 Subject: [PATCH 2/2] Fix dropped-multijson changelog position --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5aba341..d9a8d6c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,5 @@ ### Unreleased -* Fix recurring JSON issues by dropping MultiJson support. - -### 0.12.3 (2017-06-01) - * JobTimeoutError < Interrupt, to avoid accidental rescuing * Change default queue from '' to 'default' * Expose `que_dead_tuples` metric @@ -21,6 +17,10 @@ * Introduction of Kubernetes benchmark code * Performance patch to Que locking +### 0.13.0 (2017-06-08) + +* Fix recurring JSON issues by dropping MultiJson support. + ### 0.11.8 (2017-07-12) * Serialise and deserialise job args when running in sync mode. (georgea93)