Skip to content

Commit 6085518

Browse files
authored
Merge branch 'que-rb:master' into wrap_job_in_rails_executor
2 parents ea71a07 + 51403c0 commit 6085518

File tree

9 files changed

+25
-11
lines changed

9 files changed

+25
-11
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: |
4646
sudo apt-get -yqq install libpq-dev postgresql-client
4747
createdb que-test
48-
gem install bundler
48+
gem install bundler --version '~> 2.4.22'
4949
bundle install --jobs 4 --retry 3
5050
USE_RAILS=true bundle exec rake test
5151
bundle exec rake test

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<!-- MarkdownTOC autolink=true -->
44

5-
- [2.3.0 \(2023-10-10\)](#230-2023-10-16)
5+
- [2.4.0 \(2024-08-21\)](#240-2024-08-21)
6+
- [2.3.0 \(2023-10-16\)](#230-2023-10-16)
67
- [2.2.1 \(2023-04-28\)](#221-2023-04-28)
78
- [2.2.0 \(2022-08-29\)](#220-2022-08-29)
89
- [2.1.0 \(2022-08-25\)](#210-2022-08-25)
@@ -58,7 +59,18 @@
5859

5960
<!-- /MarkdownTOC -->
6061

62+
## 2.4.0 (2024-08-21)
63+
64+
- **Fixed**:
65+
+ Fixed `Que.server?` method returning the inverse of what was intended. This method can be used to determine whether Que is running as a server process (run from the Que CLI). [#426](https://github.com/que-rb/que/pull/426), context in [#382](https://github.com/que-rb/que/pull/382)
66+
- **Added**:
67+
+ Added logging of full job details rather than just `job_id`. Note that the hash `Que.log_formatter` is called with no longer contains `:job_id`; instead it now has a `:job` hash including `:id`. [#428](https://github.com/que-rb/que/pull/428)
68+
- **Documentation**:
69+
+ Improved wording of transaction recommendation in the readme for destroying a job. [#417](https://github.com/que-rb/que/pull/417)
70+
+ Added [que-view](https://github.com/kortirso/que-view) to the list of Que-compatible projects in the readme: "A Rails engine-based UI for inspecting your job queue". [#418](https://github.com/que-rb/que/pull/418)
71+
6172
## 2.3.0 (2023-10-16)
73+
6274
- **Fixed**:
6375
+ Don't clear `ActiveRecord` connections when `run_synchronously` is enabled [#393](https://github.com/que-rb/que/pull/393)
6476

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN apt-get update \
55
&& apt-get install -y libpq-dev \
66
&& rm -rf /var/lib/apt/lists/*
77

8-
ENV RUBY_BUNDLER_VERSION 2.3.7
8+
ENV RUBY_BUNDLER_VERSION 2.4.22
99
RUN gem install bundler -v $RUBY_BUNDLER_VERSION
1010

1111
ENV BUNDLE_PATH /usr/local/bundle

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ChargeCreditCard < Que::Job
9292

9393
# It's best to destroy the job in the same transaction as any other
9494
# changes you make. Que will mark the job as destroyed for you after the
95-
# run method if you don't do it yourself, but if your job writes to the DB
95+
# run method if you don't do it yourself; however if your job writes to the DB
9696
# but doesn't destroy the job in the same transaction, it's possible that
9797
# the job could be repeated in the event of a crash.
9898
destroy
@@ -189,6 +189,7 @@ There are a couple ways to do testing. You may want to set `Que::Job.run_synchro
189189
These projects are tested to be compatible with Que 1.x:
190190

191191
- [que-web](https://github.com/statianzo/que-web) is a Sinatra-based UI for inspecting your job queue.
192+
- [que-view](https://github.com/kortirso/que-view) is a Rails engine-based UI for inspecting your job queue.
192193
- [que-scheduler](https://github.com/hlascelles/que-scheduler) lets you schedule tasks using a cron style config file.
193194
- [que-locks](https://github.com/airhorns/que-locks) lets you lock around job execution for so only one job runs at once for a set of arguments.
194195
- [que-unique](https://github.com/bambooengineering/que-unique) provides fast in-memory `enqueue` deduping.

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ que --worker-count 1
349349
By default, Que logs important information in JSON to either Rails' logger (when running in a Rails web process) or STDOUT (when running via the `que` executable). So, your logs will look something like:
350350

351351
```
352-
I, [2017-08-12T05:07:31.094201 #4687] INFO -- : {"lib":"que","hostname":"lovelace","pid":21626,"thread":21471100,"event":"job_worked","job_id":6157665,"elapsed":0.531411}
352+
I, [2017-08-12T05:07:31.094201 #4687] INFO -- : {"lib":"que","hostname":"lovelace","pid":98240,"thread":42660,"event":"job_worked","job":{"priority":1,"run_at":"2024-07-24T11:07:10.056514Z","id":2869885284504751564,"job_class":"WorkerJob","error_count":0,"last_error_message":null,"queue":"default","last_error_backtrace":null,"finished_at":null,"expired_at":null,"args":[1],"data":{},"job_schema_version":2,"kwargs":{}},"elapsed":0.001356}
353353
```
354354

355355
Of course you can have it log wherever you like:

lib/que.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def default_queue
8080
end
8181

8282
def server?
83-
defined?(Que::CommandLineInterface).nil?
83+
!defined?(Que::CommandLineInterface).nil?
8484
end
8585

8686
# Support simple integration with many common connection pools.

lib/que/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module Que
4-
VERSION = '2.3.0'
4+
VERSION = '2.4.0'
55

66
def self.job_schema_version
77
2

lib/que/worker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def work_job(metajob)
114114
if VALID_LOG_LEVELS.include?(log_level)
115115
log_message = {
116116
level: log_level,
117-
job_id: metajob.id,
117+
job: metajob.job,
118118
elapsed: elapsed,
119119
}
120120

@@ -133,7 +133,7 @@ def work_job(metajob)
133133
Que.log(
134134
level: :debug,
135135
event: :job_errored,
136-
job_id: metajob.id,
136+
job: metajob.job,
137137
error: {
138138
class: error.class.to_s,
139139
message: error.message,

spec/que/worker_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def finished_job_ids
7474

7575
events = logged_messages.select{|m| m[:event] == 'job_worked'}
7676
assert_equal 3, events.count
77-
assert_equal job_ids, events.map{|m| m[:job_id]}
77+
assert_equal [1, 2, 3], events.map{|m| m.dig(:job, :priority) }
78+
assert_equal job_ids, events.map{|m| m.dig(:job, :id) }
7879
end
7980

8081
it "should handle namespaced job subclasses" do
@@ -228,7 +229,7 @@ def assert_retry_cadence(
228229

229230
# Error should be logged.
230231
event = events.first
231-
assert_equal job_ids.first, event[:job_id]
232+
assert_equal job_ids.first, event.dig(:job, :id)
232233
assert_equal "RuntimeError: Error!", event[:error]
233234

234235
# Errored job should still be in the DB.

0 commit comments

Comments
 (0)