que 2.1.0 → 2.2.1

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: '08d50e63c19dbe61966e4048eb1e30fce181e520b05f20f933220baede9cbc76'
4
- data.tar.gz: 72abbb3390310c18897739e35a2fdb5e6a8187a9b5ae27e4ee651ce4b7c8d9bf
3
+ metadata.gz: 0ab8266596317c607383b8041784ef57580260a1823ff62f7e25da2171eda072
4
+ data.tar.gz: 7af7354cb7d22d69c97070c7ef4fd075adb23af081ab75f56d587e73a940e208
5
5
  SHA512:
6
- metadata.gz: aa542178d30c1fc031ae2508ff462d0b1ff23f2e5a4e6f9b3fb1cb08ec3ac3a3cc6c167e532654124b5d72c53a319c0b74c3f3a2eb0b5e66102242b43ad59a50
7
- data.tar.gz: d3902890b359a759f9fe3c94f431afb512e312b6dc46d22223d0d3dc7154f21458a8c7592a72850318094af3c4bfe59950dc8f5bde68e314911695e39d19507a
6
+ metadata.gz: 37cbca060d09e4925d6869bee31365c315e274e7d02f9c6bfe6d866082bda4265c890785e04ed740a1d969e282b44dc38bde0accfe7c033ac170ddb136573c91
7
+ data.tar.gz: addec5796eedda7f4dd6561445b387f9066cb2096d583d33f562fb7768af15705384677ca7401086a99c012deb432cdbf138c4ca4e81b09bcbf1f010fa1924ce
@@ -7,17 +7,17 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby_version: ['2.7', '3.0', '3.1']
11
- rails_gemfile: ['6.0', '6.1']
10
+ ruby_version: ['2.7', '3.0', '3.1', '3.2']
11
+ rails_gemfile: ['6.0', '6.1', '7.0']
12
12
  postgres_version: ['14']
13
13
  include:
14
14
  # Postgres versions
15
- - { ruby_version: '3.1', rails_gemfile: '6.1', postgres_version: '9' }
16
- - { ruby_version: '3.1', rails_gemfile: '6.1', postgres_version: '10' }
17
- - { ruby_version: '3.1', rails_gemfile: '6.1', postgres_version: '11' }
18
- - { ruby_version: '3.1', rails_gemfile: '6.1', postgres_version: '12' }
19
- - { ruby_version: '3.1', rails_gemfile: '6.1', postgres_version: '13' }
20
- - { ruby_version: '3.1', rails_gemfile: '6.1', postgres_version: '14' }
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' }
21
21
  exclude: []
22
22
  name: "Test: Ruby ${{ matrix.ruby_version }}, Rails ${{ matrix.rails_gemfile }}, PostgreSQL ${{ matrix.postgres_version }}"
23
23
  services:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.1
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  <!-- MarkdownTOC autolink=true -->
4
4
 
5
+ - [2.2.1 \(2023-04-28\)](#221-2023-04-28)
6
+ - [2.2.0 \(2022-08-29\)](#220-2022-08-29)
5
7
  - [2.1.0 \(2022-08-25\)](#210-2022-08-25)
6
8
  - [2.0.0 \(2022-08-25\)](#200-2022-08-25)
7
9
  - [1.4.1 \(2022-07-24\)](#141-2022-07-24)
@@ -55,6 +57,25 @@
55
57
 
56
58
  <!-- /MarkdownTOC -->
57
59
 
60
+ ## 2.2.1 (2023-04-28)
61
+
62
+ - **Fixed**:
63
+ + Fixed support for ActiveJob in Ruby 3.2. [#390](https://github.com/que-rb/que/pull/390)
64
+
65
+ ## 2.2.0 (2022-08-29)
66
+
67
+ - **Changed**:
68
+ + When migrating, now raises an exception when the Que DB schema version is missing from the database. The migrations system records this version in a comment on the `que_jobs` table. [#379](https://github.com/que-rb/que/pull/379)
69
+ * > Que::Error: Cannot determine Que DB schema version.
70
+ >
71
+ > The que_jobs table is missing its comment recording the Que DB schema version. This is likely due to a bug in Rails schema dump in Rails 7 versions prior to 7.0.3, omitting comments - see https://github.com/que-rb/que/issues/363. Please determine the appropriate schema version from your migrations and record it manually by running the following SQL (replacing version as appropriate):
72
+ >
73
+ > COMMENT ON TABLE que_jobs IS 'version';
74
+ - **Removed**:
75
+ + Removed support for upgrading directly from a version of Que prior to v0.5.0 (released on 2014-01-14), which introduced the migrations system. It's too difficult to handle the different DB schemas from prior to this.
76
+ - **Internal**:
77
+ + Moved `command_line_interface.rb` from `bin/` to `lib/`. [#378](https://github.com/que-rb/que/pull/378)
78
+
58
79
  ## 2.1.0 (2022-08-25)
59
80
 
60
81
  - **Added**:
@@ -65,7 +86,7 @@
65
86
  This release contains a database migration. You will need to migrate Que to the latest database schema version (7). For example, on ActiveRecord and Rails 6:
66
87
 
67
88
  ```ruby
68
- class UpdateQueTablesToVersion6 < ActiveRecord::Migration[6.0]
89
+ class UpdateQueTablesToVersion7 < ActiveRecord::Migration[6.0]
69
90
  def up
70
91
  Que.migrate!(version: 7)
71
92
  end
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:3.1.1-slim-buster@sha256:2ada3e4fe7b1703c9333ad4eb9fc12c1d4d60bce0f981281b2151057e928d9ad AS base
1
+ FROM ruby:3.2.2-slim-buster@sha256:005f0892d160a4f80f8f89116ec15fddc81f296cd4083db9d59accaed125e270 AS base
2
2
 
3
3
  # Install libpq-dev in our base layer, as it's needed in all environments
4
4
  RUN apt-get update \
data/README.md CHANGED
@@ -59,7 +59,7 @@ class CreateQueSchema < ActiveRecord::Migration[6.0]
59
59
  # Whenever you use Que in a migration, always specify the version you're
60
60
  # migrating to. If you're unsure what the current version is, check the
61
61
  # changelog.
62
- Que.migrate!(version: 6)
62
+ Que.migrate!(version: 7)
63
63
  end
64
64
 
65
65
  def down
@@ -191,6 +191,7 @@ These projects are tested to be compatible with Que 1.x:
191
191
  - [que-web](https://github.com/statianzo/que-web) is a Sinatra-based UI for inspecting your job queue.
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
+ - [que-unique](https://github.com/bambooengineering/que-unique) provides fast in-memory `enqueue` deduping.
194
195
 
195
196
  If you have a project that uses or relates to Que, feel free to submit a PR adding it to the list!
196
197
 
data/bin/que CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative 'command_line_interface'
4
+ require 'que/command_line_interface'
5
5
 
6
6
  $stdout.sync = true
7
7
 
data/docker-compose.yml CHANGED
@@ -10,7 +10,7 @@ services:
10
10
  - db
11
11
  volumes:
12
12
  - .:/work
13
- - ruby-3.1.1-gem-cache:/usr/local/bundle
13
+ - ruby-3.2.2-gem-cache:/usr/local/bundle
14
14
  - ~/.docker-rc.d/:/.docker-rc.d/:ro
15
15
  working_dir: /work
16
16
  entrypoint: /work/scripts/docker-entrypoint
@@ -44,4 +44,4 @@ services:
44
44
 
45
45
  volumes:
46
46
  db-data: ~
47
- ruby-3.1.1-gem-cache: ~
47
+ ruby-3.2.2-gem-cache: ~
data/docs/README.md CHANGED
@@ -139,8 +139,8 @@ There are other docs to read if you're using [Sequel](#using-sequel) or [plain P
139
139
  After you've connected Que to the database, you can manage the jobs table. You'll want to migrate to a specific version in a migration file, to ensure that they work the same way even when you upgrade Que in the future:
140
140
 
141
141
  ```ruby
142
- # Update the schema to version #6.
143
- Que.migrate!(version: 6)
142
+ # Update the schema to version #7.
143
+ Que.migrate!(version: 7)
144
144
 
145
145
  # Remove Que's jobs table entirely.
146
146
  Que.migrate!(version: 0)
@@ -553,7 +553,7 @@ require 'que'
553
553
  Sequel.migration do
554
554
  up do
555
555
  Que.connection = self
556
- Que.migrate!(version: 6)
556
+ Que.migrate!(version: 7)
557
557
  end
558
558
  down do
559
559
  Que.connection = self
@@ -10,6 +10,7 @@ module Que
10
10
  def run(*args)
11
11
  raise Error, "Job class #{self.class} didn't define a run() method!"
12
12
  end
13
+ ruby2_keywords(:run) if respond_to?(:ruby2_keywords, true)
13
14
 
14
15
  def perform(*args)
15
16
  args, kwargs = Que.split_out_ruby2_keywords(args)
@@ -31,6 +32,7 @@ module Que
31
32
  ),
32
33
  )
33
34
  end
35
+ ruby2_keywords(:perform) if respond_to?(:ruby2_keywords, true)
34
36
 
35
37
  private
36
38
 
data/lib/que/locker.rb CHANGED
@@ -7,6 +7,10 @@
7
7
  require 'set'
8
8
 
9
9
  module Que
10
+ class << self
11
+ attr_accessor :locker
12
+ end
13
+
10
14
  Listener::MESSAGE_FORMATS[:job_available] =
11
15
  {
12
16
  queue: String,
@@ -71,6 +75,11 @@ module Que
71
75
  Que.assert Array, worker_priorities
72
76
  worker_priorities.each { |p| Que.assert([Integer, NilClass], p) }
73
77
 
78
+ # We assign this globally because we only ever expect one locker to be
79
+ # created per worker process. This can be used by middleware or external
80
+ # code to access the locker during runtime.
81
+ Que.locker = self
82
+
74
83
  # We use a JobBuffer to track jobs and pass them to workers, and a
75
84
  # ResultQueue to receive messages from workers.
76
85
  @job_buffer = JobBuffer.new(
@@ -48,14 +48,27 @@ module Que
48
48
  # No table in the database at all.
49
49
  0
50
50
  elsif (d = result.first[:description]).nil?
51
- # There's a table, it was just created before the migration system
52
- # existed.
53
- 1
51
+ # The table exists but the version comment is missing
52
+ _raise_db_version_comment_missing_error
54
53
  else
55
54
  d.to_i
56
55
  end
57
56
  end
58
57
 
58
+ # The que_jobs table could be missing the schema version comment either due to:
59
+ # - Being created before the migration system existed; or
60
+ # - A bug in Rails schema dump in some versions of Rails
61
+ # The former is the case on Que versions prior to v0.5.0 (2014-01-14). Upgrading directly from there is unsupported, so we just raise in all cases of the comment being missing
62
+ def _raise_db_version_comment_missing_error
63
+ raise Error, <<~ERROR
64
+ Cannot determine Que DB schema version.
65
+
66
+ The que_jobs table is missing its comment recording the Que DB schema version. This is likely due to a bug in Rails schema dump in Rails 7 versions prior to 7.0.3, omitting comments - see https://github.com/que-rb/que/issues/363. Please determine the appropriate schema version from your migrations and record it manually by running the following SQL (replacing version as appropriate):
67
+
68
+ COMMENT ON TABLE que_jobs IS 'version';
69
+ ERROR
70
+ end
71
+
59
72
  def set_db_version(version)
60
73
  i = version.to_i
61
74
  Que.execute "COMMENT ON TABLE que_jobs IS '#{i}'" unless i.zero?
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.1.0'
4
+ VERSION = '2.2.1'
5
5
 
6
6
  def self.job_schema_version
7
7
  2
data/lib/que.rb CHANGED
@@ -79,6 +79,10 @@ module Que
79
79
  @default_queue || DEFAULT_QUEUE
80
80
  end
81
81
 
82
+ def server?
83
+ defined?(Que::CommandLineInterface).nil?
84
+ end
85
+
82
86
  # Support simple integration with many common connection pools.
83
87
  def connection=(conn)
84
88
  self.connection_proc =
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.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hanks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-25 00:00:00.000000000 Z
11
+ date: 2023-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -45,7 +45,6 @@ files:
45
45
  - auto/psql
46
46
  - auto/test
47
47
  - auto/test-postgres-14
48
- - bin/command_line_interface.rb
49
48
  - bin/que
50
49
  - docker-compose.yml
51
50
  - docs/README.md
@@ -53,6 +52,7 @@ files:
53
52
  - lib/que/active_job/extensions.rb
54
53
  - lib/que/active_record/connection.rb
55
54
  - lib/que/active_record/model.rb
55
+ - lib/que/command_line_interface.rb
56
56
  - lib/que/connection.rb
57
57
  - lib/que/connection_pool.rb
58
58
  - lib/que/job.rb
@@ -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.3.7
118
+ rubygems_version: 3.4.10
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: A PostgreSQL-based Job Queue
File without changes