que 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6ba77a9666d67547e81022c081b95d0ff1087a25d31e8ae2400213e81e54f2d
4
- data.tar.gz: fe9220bf6fe842fd7b0b401ae37440e9a5f7033d9fa59594ceeb1eff802c7ecb
3
+ metadata.gz: 37c1d6014ec840c445c2142cdd46646409b21d1513bcd1a6d6cea125afe714fb
4
+ data.tar.gz: bf5215a463ca64b5acee7a6a080296e9dcb39b9fea8399576ad758e63e424edd
5
5
  SHA512:
6
- metadata.gz: 96f9ca6172cc8c69055dbd94557cc818aa7bf360437437a3da0ef502ef280b0c9d9b9d4b6f811dcefe06f2f6079902c6b556f8120171ac743f4308bc0063a17f
7
- data.tar.gz: '039af963aa1d2106c85144067ee6ec6119f6a7bad22f3301b3c018e46c636e8329c25bd8443460706ef41d9822dcee15e8629ac120cb422ba62a681324f127b8'
6
+ metadata.gz: 32845cf47073ed8bda56f7bd4594dbd65cceb48324460436437251049fda2548bda517db107034733c5dbbf15edba403111afaf41526ae6a09356aee5b9b93e9
7
+ data.tar.gz: 791a05612735d7b7480557039001c9d11946b6bffca4f895d44b6a9d58e6c2b78eebb8e20b8440076832e4333e77196f2bb60849fb0f51861ba6572f202d4da7
@@ -45,7 +45,7 @@ jobs:
45
45
  run: |
46
46
  sudo apt-get -yqq install libpq-dev postgresql-client
47
47
  createdb que-test
48
- gem install bundler
48
+ gem install bundler --version '~> 2.4.22'
49
49
  bundle install --jobs 4 --retry 3
50
50
  USE_RAILS=true bundle exec rake test
51
51
  bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  <!-- MarkdownTOC autolink=true -->
4
4
 
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)
6
7
  - [2.2.1 \(2023-04-28\)](#221-2023-04-28)
7
8
  - [2.2.0 \(2022-08-29\)](#220-2022-08-29)
8
9
  - [2.1.0 \(2022-08-25\)](#210-2022-08-25)
@@ -58,7 +59,18 @@
58
59
 
59
60
  <!-- /MarkdownTOC -->
60
61
 
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
+
61
72
  ## 2.3.0 (2023-10-16)
73
+
62
74
  - **Fixed**:
63
75
  + Don't clear `ActiveRecord` connections when `run_synchronously` is enabled [#393](https://github.com/que-rb/que/pull/393)
64
76
 
data/Dockerfile CHANGED
@@ -5,7 +5,7 @@ RUN apt-get update \
5
5
  && apt-get install -y libpq-dev \
6
6
  && rm -rf /var/lib/apt/lists/*
7
7
 
8
- ENV RUBY_BUNDLER_VERSION 2.3.7
8
+ ENV RUBY_BUNDLER_VERSION 2.4.22
9
9
  RUN gem install bundler -v $RUBY_BUNDLER_VERSION
10
10
 
11
11
  ENV BUNDLE_PATH /usr/local/bundle
data/README.md CHANGED
@@ -92,7 +92,7 @@ class ChargeCreditCard < Que::Job
92
92
 
93
93
  # It's best to destroy the job in the same transaction as any other
94
94
  # 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
96
96
  # but doesn't destroy the job in the same transaction, it's possible that
97
97
  # the job could be repeated in the event of a crash.
98
98
  destroy
@@ -189,6 +189,7 @@ There are a couple ways to do testing. You may want to set `Que::Job.run_synchro
189
189
  These projects are tested to be compatible with Que 1.x:
190
190
 
191
191
  - [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.
192
193
  - [que-scheduler](https://github.com/hlascelles/que-scheduler) lets you schedule tasks using a cron style config file.
193
194
  - [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.
194
195
  - [que-unique](https://github.com/bambooengineering/que-unique) provides fast in-memory `enqueue` deduping.
data/docs/README.md CHANGED
@@ -349,7 +349,7 @@ que --worker-count 1
349
349
  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:
350
350
 
351
351
  ```
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}
353
353
  ```
354
354
 
355
355
  Of course you can have it log wherever you like:
@@ -159,6 +159,14 @@ module Que
159
159
  ) do |p|
160
160
  options[:wait_period] = p
161
161
  end
162
+
163
+ opts.on(
164
+ '--pidfile [PATH]',
165
+ String,
166
+ "Write the PID of this process to the specified file.",
167
+ ) do |p|
168
+ options[:pidfile] = File.expand_path(p)
169
+ end
162
170
  end
163
171
 
164
172
  parser.parse!(args)
data/lib/que/locker.rb CHANGED
@@ -61,7 +61,8 @@ module Que
61
61
  wait_period: DEFAULT_WAIT_PERIOD,
62
62
  maximum_buffer_size: DEFAULT_MAXIMUM_BUFFER_SIZE,
63
63
  worker_priorities: DEFAULT_WORKER_PRIORITIES,
64
- on_worker_start: nil
64
+ on_worker_start: nil,
65
+ pidfile: nil
65
66
  )
66
67
 
67
68
  # Sanity-check all our arguments, since some users may instantiate Locker
@@ -215,10 +216,16 @@ module Que
215
216
  @connection.wrapped_connection.close
216
217
  end
217
218
  end
219
+
220
+ @pidfile = pidfile
221
+ at_exit { delete_pid }
222
+ write_pid
218
223
  end
219
224
 
220
225
  def stop!
221
- stop; wait_for_stop
226
+ stop
227
+ wait_for_stop
228
+ delete_pid
222
229
  end
223
230
 
224
231
  def stop
@@ -512,5 +519,19 @@ module Que
512
519
  "Tried to lock a job that was already locked: #{id}"
513
520
  end
514
521
  end
522
+
523
+ def write_pid
524
+ return unless @pidfile
525
+
526
+ File.open(@pidfile, "w+") do |f|
527
+ f.write(Process.pid.to_s)
528
+ end
529
+ end
530
+
531
+ def delete_pid
532
+ return unless @pidfile
533
+
534
+ File.delete(@pidfile) if File.exist?(@pidfile)
535
+ end
515
536
  end
516
537
  end
data/lib/que/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Que
4
- VERSION = '2.3.0'
4
+ VERSION = '2.4.0'
5
5
 
6
6
  def self.job_schema_version
7
7
  2
data/lib/que/worker.rb CHANGED
@@ -114,7 +114,7 @@ module Que
114
114
  if VALID_LOG_LEVELS.include?(log_level)
115
115
  log_message = {
116
116
  level: log_level,
117
- job_id: metajob.id,
117
+ job: metajob.job,
118
118
  elapsed: elapsed,
119
119
  }
120
120
 
@@ -133,7 +133,7 @@ module Que
133
133
  Que.log(
134
134
  level: :debug,
135
135
  event: :job_errored,
136
- job_id: metajob.id,
136
+ job: metajob.job,
137
137
  error: {
138
138
  class: error.class.to_s,
139
139
  message: error.message,
data/lib/que.rb CHANGED
@@ -80,7 +80,7 @@ module Que
80
80
  end
81
81
 
82
82
  def server?
83
- defined?(Que::CommandLineInterface).nil?
83
+ !defined?(Que::CommandLineInterface).nil?
84
84
  end
85
85
 
86
86
  # Support simple integration with many common connection pools.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: que
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hanks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.4.10
118
+ rubygems_version: 3.5.7
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: A PostgreSQL-based Job Queue