Skip to content
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

Port Rails 6 time fix #2

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/command_line_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def parse(
$stop_que_executable = false
%w[INT TERM].each { |signal| trap(signal) { $stop_que_executable = true } }

output.puts "Que started with #{locker.workers.length} workers (priorities: #{locker.workers.map(&:priority)})"
output.puts "Que waiting for jobs..."

loop do
Expand Down
1 change: 1 addition & 0 deletions bin/command_line_interface.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def write_file

assert_equal(
[
"Que started with 6 workers (priorities: [10, 30, 50, nil, nil, nil])",
"Que waiting for jobs...",
"\nFinishing Que's current jobs before exiting...",
"Que's jobs finished, exiting...",
Expand Down
5 changes: 3 additions & 2 deletions lib/que/active_record/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ class Model < ::ActiveRecord::Base
class << self
def by_job_class(job_class)
job_class = job_class.name if job_class.is_a?(Class)
job_class_doc = "[{\"job_class\": \"#{job_class}\"}]"
where(
"que_jobs.job_class = ? OR (que_jobs.job_class = 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' AND que_jobs.args->0->>'job_class' = ?)",
job_class, job_class,
"que_jobs.job_class = ? OR (que_jobs.job_class = 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' AND que_jobs.args @> ?)",
job_class, job_class_doc,
)
end

Expand Down
8 changes: 7 additions & 1 deletion lib/que/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ def convert_params(params)
},

# 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
}
}

# JSON, JSONB
Expand Down
2 changes: 1 addition & 1 deletion lib/que/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Job
(
coalesce($1, 'default')::text,
coalesce($2, 100)::smallint,
coalesce($3, now())::timestamptz,
greatest($3, now())::timestamptz,
$4::text,
coalesce($5, '[]')::jsonb,
coalesce($6, '{}')::jsonb
Expand Down