que 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ab8266596317c607383b8041784ef57580260a1823ff62f7e25da2171eda072
4
- data.tar.gz: 7af7354cb7d22d69c97070c7ef4fd075adb23af081ab75f56d587e73a940e208
3
+ metadata.gz: b6ba77a9666d67547e81022c081b95d0ff1087a25d31e8ae2400213e81e54f2d
4
+ data.tar.gz: fe9220bf6fe842fd7b0b401ae37440e9a5f7033d9fa59594ceeb1eff802c7ecb
5
5
  SHA512:
6
- metadata.gz: 37cbca060d09e4925d6869bee31365c315e274e7d02f9c6bfe6d866082bda4265c890785e04ed740a1d969e282b44dc38bde0accfe7c033ac170ddb136573c91
7
- data.tar.gz: addec5796eedda7f4dd6561445b387f9066cb2096d583d33f562fb7768af15705384677ca7401086a99c012deb432cdbf138c4ca4e81b09bcbf1f010fa1924ce
6
+ metadata.gz: 96f9ca6172cc8c69055dbd94557cc818aa7bf360437437a3da0ef502ef280b0c9d9b9d4b6f811dcefe06f2f6079902c6b556f8120171ac743f4308bc0063a17f
7
+ data.tar.gz: '039af963aa1d2106c85144067ee6ec6119f6a7bad22f3301b3c018e46c636e8329c25bd8443460706ef41d9822dcee15e8629ac120cb422ba62a681324f127b8'
@@ -8,16 +8,16 @@ jobs:
8
8
  strategy:
9
9
  matrix:
10
10
  ruby_version: ['2.7', '3.0', '3.1', '3.2']
11
- rails_gemfile: ['6.0', '6.1', '7.0']
11
+ rails_gemfile: ['6.0', '6.1', '7.0', '7.1']
12
12
  postgres_version: ['14']
13
13
  include:
14
14
  # Postgres versions
15
- - { ruby_version: '3.2', rails_gemfile: '7.0', postgres_version: '9' }
16
- - { ruby_version: '3.2', rails_gemfile: '7.0', postgres_version: '10' }
17
- - { ruby_version: '3.2', rails_gemfile: '7.0', postgres_version: '11' }
18
- - { ruby_version: '3.2', rails_gemfile: '7.0', postgres_version: '12' }
19
- - { ruby_version: '3.2', rails_gemfile: '7.0', postgres_version: '13' }
20
- - { ruby_version: '3.2', rails_gemfile: '7.0', postgres_version: '14' }
15
+ - { ruby_version: '3.2', rails_gemfile: '7.1', postgres_version: '9' }
16
+ - { ruby_version: '3.2', rails_gemfile: '7.1', postgres_version: '10' }
17
+ - { ruby_version: '3.2', rails_gemfile: '7.1', postgres_version: '11' }
18
+ - { ruby_version: '3.2', rails_gemfile: '7.1', postgres_version: '12' }
19
+ - { ruby_version: '3.2', rails_gemfile: '7.1', postgres_version: '13' }
20
+ - { ruby_version: '3.2', rails_gemfile: '7.1', postgres_version: '14' }
21
21
  exclude: []
22
22
  name: "Test: Ruby ${{ matrix.ruby_version }}, Rails ${{ matrix.rails_gemfile }}, PostgreSQL ${{ matrix.postgres_version }}"
23
23
  services:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  <!-- MarkdownTOC autolink=true -->
4
4
 
5
+ - [2.3.0 \(2023-10-10\)](#230-2023-10-16)
5
6
  - [2.2.1 \(2023-04-28\)](#221-2023-04-28)
6
7
  - [2.2.0 \(2022-08-29\)](#220-2022-08-29)
7
8
  - [2.1.0 \(2022-08-25\)](#210-2022-08-25)
@@ -57,6 +58,17 @@
57
58
 
58
59
  <!-- /MarkdownTOC -->
59
60
 
61
+ ## 2.3.0 (2023-10-16)
62
+ - **Fixed**:
63
+ + Don't clear `ActiveRecord` connections when `run_synchronously` is enabled [#393](https://github.com/que-rb/que/pull/393)
64
+
65
+ - **Changed**
66
+ + Improve performance of query used by `QueJob#by_job_class` for jobs wrapped by `ActiveJob` [#394](https://github.com/que-rb/que/pull/394)
67
+
68
+ - **Added**
69
+ + Allow `que` to be started without listen/notify [#395](https://github.com/que-rb/que/pull/395)
70
+ + Support Rails 7.1+ [#403](https://github.com/que-rb/que/pull/403)
71
+
60
72
  ## 2.2.1 (2023-04-28)
61
73
 
62
74
  - **Fixed**:
data/README.md CHANGED
@@ -192,6 +192,7 @@ These projects are tested to be compatible with Que 1.x:
192
192
  - [que-scheduler](https://github.com/hlascelles/que-scheduler) lets you schedule tasks using a cron style config file.
193
193
  - [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
194
  - [que-unique](https://github.com/bambooengineering/que-unique) provides fast in-memory `enqueue` deduping.
195
+ - [que-prometheus](https://github.com/mnbbrown/que-prometheus) exposes Prometheus API endpoints for job, worker, and queue metrics
195
196
 
196
197
  If you have a project that uses or relates to Que, feel free to submit a PR adding it to the list!
197
198
 
@@ -108,6 +108,41 @@ module Que
108
108
  end
109
109
  end
110
110
 
111
+ # This is the ActiveJob Que adapter for Rails 7.1+, given ActiveJob::QueueAdapters::QueAdapter has been removed from ActiveJob.
112
+ # For backwards compatibility, the class name of ActiveJob::QueueAdapters::QueAdapter::JobWrapper must remain the same, given this string would be in old job records in the database
113
+ if ActiveJob.gem_version >= Gem::Version.new('7.1')
114
+ module ActiveJob
115
+ module QueueAdapters
116
+ # Work around `autoload QueAdapter` being left over in ActiveJob after the adapter was removed
117
+ remove_const(:QueAdapter) if const_defined?(:QueAdapter)
118
+
119
+ class QueAdapter
120
+ def enqueue(job)
121
+ job_options = { priority: job.priority, queue: job.queue_name }
122
+ que_job = JobWrapper.enqueue job.serialize, **job_options
123
+ job.provider_job_id = que_job.attrs["job_id"]
124
+ que_job
125
+ end
126
+
127
+ def enqueue_at(job, timestamp)
128
+ job_options = { priority: job.priority, queue: job.queue_name, run_at: Time.at(timestamp) }
129
+ que_job = JobWrapper.enqueue job.serialize, **job_options
130
+ job.provider_job_id = que_job.attrs["job_id"]
131
+ que_job
132
+ end
133
+
134
+ private
135
+
136
+ class JobWrapper < Que::Job
137
+ def run(job_data)
138
+ Base.execute job_data
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
144
+ end
145
+
111
146
  class ActiveJob::QueueAdapters::QueAdapter
112
147
  class JobWrapper < Que::Job
113
148
  extend Que::ActiveJob::WrapperExtensions::ClassMethods
@@ -42,7 +42,7 @@ module Que
42
42
  # feature to unknowingly leak connections to other databases. So,
43
43
  # take the additional step of telling ActiveRecord to check in all
44
44
  # of the current thread's connections after each job is run.
45
- ::ActiveRecord::Base.clear_active_connections!
45
+ ::ActiveRecord::Base.clear_active_connections! unless job.class.resolve_que_setting(:run_synchronously)
46
46
  end
47
47
  end
48
48
  end
@@ -25,9 +25,10 @@ module Que
25
25
  class << self
26
26
  def by_job_class(job_class)
27
27
  job_class = job_class.name if job_class.is_a?(Class)
28
+ job_class_doc = "[{\"job_class\": \"#{job_class}\"}]"
28
29
  where(
29
- "que_jobs.job_class = ? OR (que_jobs.job_class = 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' AND que_jobs.args->0->>'job_class' = ?)",
30
- job_class, job_class,
30
+ "que_jobs.job_class = ? OR (que_jobs.job_class = 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' AND que_jobs.args @> ?)",
31
+ job_class, job_class_doc,
31
32
  )
32
33
  end
33
34
 
@@ -50,6 +50,14 @@ module Que
50
50
  poll_interval = i
51
51
  end
52
52
 
53
+ opts.on(
54
+ '--listen [LISTEN]',
55
+ String,
56
+ "Set to false to disable listen mode (default: true)"
57
+ ) do |listen|
58
+ options[:listen] = listen != "false"
59
+ end
60
+
53
61
  opts.on(
54
62
  '-l',
55
63
  '--log-level [LEVEL]',
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.2.1'
4
+ VERSION = '2.3.0'
5
5
 
6
6
  def self.job_schema_version
7
7
  2
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.2.1
4
+ version: 2.3.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-04-28 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler