From 9b1471023cd90b05cb48dde51c4a4950b2c46efe Mon Sep 17 00:00:00 2001 From: Nick Campbell Date: Wed, 25 Sep 2019 16:10:14 +0100 Subject: [PATCH] Be more resilient against unexpected time values. Ported from upstream que@5ddddd5ebac6153d7a683ef08c86bced8e03fb51 This seems to be breaking in Rails 6. --- lib/que/adapters/base.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/que/adapters/base.rb b/lib/que/adapters/base.rb index e5a71083..e77869be 100644 --- a/lib/que/adapters/base.rb +++ b/lib/que/adapters/base.rb @@ -107,7 +107,13 @@ def execute_prepared(name, params) # json 114 => ->(value) { JSON_MODULE.load(value, create_additions: false) }, # timestamp with time zone - 1184 => Time.method(:parse), + 1184 => ->(value) { + case value + when Time then value + when String then Time.parse(value) + else raise "Unexpected time class: #{value.class} (#{value.inspect})" + end + }, }.freeze def cast_result(result)