que 1.1.0 → 1.2.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/que/job.rb +32 -15
- data/lib/que/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 967eded27a81df945b65911275dcdc7925113727bfd06fbc42cb780a3bfb6fcf
|
4
|
+
data.tar.gz: 87607b262263b13623b4b09822a478c02179e57cfa503f253e3e678ac8b1490a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d8242fe07445a6f4658f322dd1a7cdb8918c8a56c2bfad2db49c58695b4ebae183e6a56159abc4ff74316006e7d95459ab6cfd8a4c98410eea50a2e4fb52509
|
7
|
+
data.tar.gz: 24fdf63cab7ff6e8a2ffa6ed598718d3c2ae2cbc6ef61de22ab6f1541b0cc23bab980fe5d10bbcb54823b2a529cd1cdc9d57437db3905e802bec92a04ea3ed94
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### 1.2.0 (2022-02-23)
|
2
|
+
|
3
|
+
- **Deprecated**
|
4
|
+
+ Providing job options as top level keyword arguments to Job.enqueue is now deprecated. Support will be dropped in `2.0`. Job options should be nested under the `job_options` keyword arg instead. See [#336](https://github.com/que-rb/que/pull/336)
|
5
|
+
|
1
6
|
### 1.1.0 (2022-02-21)
|
2
7
|
|
3
8
|
- **Features**:
|
data/lib/que/job.rb
CHANGED
@@ -57,22 +57,18 @@ module Que
|
|
57
57
|
|
58
58
|
def enqueue(
|
59
59
|
*args,
|
60
|
-
|
61
|
-
priority: nil,
|
62
|
-
run_at: nil,
|
63
|
-
job_class: nil,
|
64
|
-
tags: nil,
|
60
|
+
job_options: {},
|
65
61
|
**arg_opts
|
66
62
|
)
|
67
|
-
|
63
|
+
arg_opts, job_options = _extract_job_options(arg_opts, job_options.dup)
|
68
64
|
args << arg_opts if arg_opts.any?
|
69
65
|
|
70
|
-
if tags
|
71
|
-
if tags.length > MAXIMUM_TAGS_COUNT
|
72
|
-
raise Que::Error, "Can't enqueue a job with more than #{MAXIMUM_TAGS_COUNT} tags! (passed #{tags.length})"
|
66
|
+
if job_options[:tags]
|
67
|
+
if job_options[:tags].length > MAXIMUM_TAGS_COUNT
|
68
|
+
raise Que::Error, "Can't enqueue a job with more than #{MAXIMUM_TAGS_COUNT} tags! (passed #{job_options[:tags].length})"
|
73
69
|
end
|
74
70
|
|
75
|
-
tags.each do |tag|
|
71
|
+
job_options[:tags].each do |tag|
|
76
72
|
if tag.length > MAXIMUM_TAG_LENGTH
|
77
73
|
raise Que::Error, "Can't enqueue a job with a tag longer than 100 characters! (\"#{tag}\")"
|
78
74
|
end
|
@@ -80,13 +76,13 @@ module Que
|
|
80
76
|
end
|
81
77
|
|
82
78
|
attrs = {
|
83
|
-
queue: queue || resolve_que_setting(:queue) || Que.default_queue,
|
84
|
-
priority: priority || resolve_que_setting(:priority),
|
85
|
-
run_at: run_at || resolve_que_setting(:run_at),
|
79
|
+
queue: job_options[:queue] || resolve_que_setting(:queue) || Que.default_queue,
|
80
|
+
priority: job_options[:priority] || resolve_que_setting(:priority),
|
81
|
+
run_at: job_options[:run_at] || resolve_que_setting(:run_at),
|
86
82
|
args: Que.serialize_json(args),
|
87
|
-
data: tags ? Que.serialize_json(tags: tags) : "{}",
|
83
|
+
data: job_options[:tags] ? Que.serialize_json(tags: job_options[:tags]) : "{}",
|
88
84
|
job_class: \
|
89
|
-
job_class || name ||
|
85
|
+
job_options[:job_class] || name ||
|
90
86
|
raise(Error, "Can't enqueue an anonymous subclass of Que::Job"),
|
91
87
|
}
|
92
88
|
|
@@ -139,6 +135,27 @@ module Que
|
|
139
135
|
end
|
140
136
|
end
|
141
137
|
end
|
138
|
+
|
139
|
+
def _extract_job_options(arg_opts, job_options)
|
140
|
+
deprecated_job_option_names = []
|
141
|
+
|
142
|
+
%i[queue priority run_at job_class tags].each do |option_name|
|
143
|
+
next unless arg_opts.key?(option_name) && job_options[option_name].nil?
|
144
|
+
|
145
|
+
job_options[option_name] = arg_opts.delete(option_name)
|
146
|
+
deprecated_job_option_names << option_name
|
147
|
+
end
|
148
|
+
|
149
|
+
_log_job_options_deprecation(deprecated_job_option_names)
|
150
|
+
|
151
|
+
[arg_opts, job_options]
|
152
|
+
end
|
153
|
+
|
154
|
+
def _log_job_options_deprecation(deprecated_job_option_names)
|
155
|
+
return unless deprecated_job_option_names.any?
|
156
|
+
|
157
|
+
warn "Passing job options like (#{deprecated_job_option_names.join(', ')}) to `JobClass.enqueue` as top level keyword args has been deprecated and will be removed in version 2.0. Please wrap job options in an explicit `job_options` keyword arg instead."
|
158
|
+
end
|
142
159
|
end
|
143
160
|
|
144
161
|
# Set up some defaults.
|
data/lib/que/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.2.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: 2022-02-
|
11
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.1.6
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: A PostgreSQL-based Job Queue
|