que-scheduler 4.0.3 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/que/scheduler/configuration.rb +2 -5
- data/lib/que/scheduler/db.rb +2 -0
- data/lib/que/scheduler/defined_job.rb +1 -1
- data/lib/que/scheduler/jobs/que_scheduler_audit_clear_down_job.rb +1 -1
- data/lib/que/scheduler/schedule.rb +7 -6
- data/lib/que/scheduler/to_enqueue.rb +5 -7
- data/lib/que/scheduler/version.rb +1 -1
- data/lib/que/scheduler/version_support.rb +5 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a75db11d923c140204bd92360916e4cacaac5531fc25470616a4d558dde22dd3
|
4
|
+
data.tar.gz: ba08caa1a8bf8a87532da3fa5cbfc8b720784e88354ab74b240c5d724c46fb07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ad5f4284dd03b6129d970e87cdd1652f8e992a5c141c032fc4935beaea2bbf15f35253c5c5f6c93e3cf6b32875beb6138112d43e8e5e123235c32fa9593984
|
7
|
+
data.tar.gz: f8618b848befcccf03387fe2e891f201790c1dc8b736406a62bd3d63990ac1c8f47737966103713d843a627ec39d2ff23128570dd6b03cd28682bc4613638fcf
|
data/README.md
CHANGED
@@ -309,7 +309,7 @@ A full changelog can be found here: [CHANGELOG.md](https://github.com/hlascelles
|
|
309
309
|
|
310
310
|
## System requirements
|
311
311
|
|
312
|
-
Your [postgres](https://www.postgresql.org/) database must be at least version 9.
|
312
|
+
Your [postgres](https://www.postgresql.org/) database must be at least version 9.5.0.
|
313
313
|
|
314
314
|
## Inspiration
|
315
315
|
|
@@ -318,6 +318,7 @@ This gem was inspired by the makers of the excellent [Que](https://github.com/ch
|
|
318
318
|
## Contributors
|
319
319
|
|
320
320
|
* @bnauta
|
321
|
+
* @bjeanes
|
321
322
|
* @JackDanger
|
322
323
|
* @jish
|
323
324
|
* @joehorsnell
|
@@ -4,11 +4,8 @@ require_relative "version_support"
|
|
4
4
|
module Que
|
5
5
|
module Scheduler
|
6
6
|
class Configuration
|
7
|
-
attr_accessor :schedule_location
|
8
|
-
|
9
|
-
attr_accessor :transaction_adapter
|
10
|
-
attr_accessor :que_scheduler_queue
|
11
|
-
attr_accessor :time_zone
|
7
|
+
attr_accessor :schedule_location, :schedule, :transaction_adapter, :que_scheduler_queue,
|
8
|
+
:time_zone
|
12
9
|
end
|
13
10
|
|
14
11
|
class << self
|
data/lib/que/scheduler/db.rb
CHANGED
@@ -18,9 +18,11 @@ module Que
|
|
18
18
|
Que::Scheduler::VersionSupport.execute(NOW_SQL).first.values.first
|
19
19
|
end
|
20
20
|
|
21
|
+
# rubocop:disable Style/ExplicitBlockArgument
|
21
22
|
def transaction
|
22
23
|
Que::Scheduler.configuration.transaction_adapter.call { yield }
|
23
24
|
end
|
25
|
+
# rubocop:enable Style/ExplicitBlockArgument
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -86,7 +86,7 @@ module Que
|
|
86
86
|
# queue name is only supported for a subrange of ActiveJob versions. Print this out as a
|
87
87
|
# warning.
|
88
88
|
if queue &&
|
89
|
-
Que::Scheduler::ToEnqueue.
|
89
|
+
Que::Scheduler::ToEnqueue.active_job_loaded? &&
|
90
90
|
job_class < ::ActiveJob::Base &&
|
91
91
|
Que::Scheduler::ToEnqueue.active_job_version < Gem::Version.create("6.0.3")
|
92
92
|
puts <<~ERR
|
@@ -28,7 +28,7 @@ module Que
|
|
28
28
|
Que::Scheduler::VersionSupport.set_priority(self, 100)
|
29
29
|
|
30
30
|
def run(options)
|
31
|
-
retain_row_count = options.fetch(:retain_row_count)
|
31
|
+
retain_row_count = options.symbolize_keys.fetch(:retain_row_count)
|
32
32
|
Que::Scheduler::Db.transaction do
|
33
33
|
# This may delete zero or more than `retain_row_count` depending on if anything was
|
34
34
|
# scheduled in each of the past schedule runs
|
@@ -37,7 +37,8 @@ module Que
|
|
37
37
|
|
38
38
|
def from_hash(config_hash)
|
39
39
|
config_hash.map do |name, defined_job_hash|
|
40
|
-
|
40
|
+
name_str = name.to_s
|
41
|
+
[name_str, hash_item_to_defined_job(name_str, defined_job_hash)]
|
41
42
|
end.to_h
|
42
43
|
end
|
43
44
|
|
@@ -48,10 +49,7 @@ module Que
|
|
48
49
|
# an array with one item which is that value (this includes if it is a hash). It could
|
49
50
|
# also be a single nil value.
|
50
51
|
args_array =
|
51
|
-
if
|
52
|
-
# No args were requested
|
53
|
-
[]
|
54
|
-
else
|
52
|
+
if defined_job_hash.key?("args")
|
55
53
|
args = defined_job_hash["args"]
|
56
54
|
if args.is_a?(Array)
|
57
55
|
# An array of args was requested
|
@@ -61,11 +59,14 @@ module Que
|
|
61
59
|
# be enqueued as an array of 1 item
|
62
60
|
[args]
|
63
61
|
end
|
62
|
+
else
|
63
|
+
# No args were requested
|
64
|
+
[]
|
64
65
|
end
|
65
66
|
|
66
67
|
Que::Scheduler::DefinedJob.create(
|
67
68
|
name: name,
|
68
|
-
job_class: defined_job_hash["class"] || name,
|
69
|
+
job_class: defined_job_hash["class"]&.to_s || name,
|
69
70
|
queue: defined_job_hash["queue"],
|
70
71
|
args_array: args_array,
|
71
72
|
priority: defined_job_hash["priority"],
|
@@ -22,14 +22,12 @@ module Que
|
|
22
22
|
type_from_job_class(job_class).present?
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
25
|
+
def active_job_loaded?
|
26
|
+
!!active_job_version
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
|
31
|
-
# https://github.com/rails/rails/pull/20056/files
|
32
|
-
active_job_version && active_job_version > Gem::Version.create("5")
|
29
|
+
def active_job_version
|
30
|
+
Gem.loaded_specs["activejob"]&.version
|
33
31
|
end
|
34
32
|
|
35
33
|
def active_job_version_supports_queues?
|
@@ -56,7 +54,7 @@ module Que
|
|
56
54
|
hash = {
|
57
55
|
::Que::Job => QueJobType,
|
58
56
|
}
|
59
|
-
hash[::ActiveJob::Base] = ActiveJobType if ToEnqueue.
|
57
|
+
hash[::ActiveJob::Base] = ActiveJobType if ToEnqueue.active_job_loaded?
|
60
58
|
hash
|
61
59
|
end
|
62
60
|
end
|
@@ -61,7 +61,11 @@ module Que
|
|
61
61
|
|
62
62
|
def zero_major?
|
63
63
|
# This is the only way to handle beta releases too
|
64
|
-
@zero_major ||=
|
64
|
+
@zero_major ||= que_version.split(".").first.to_i.zero?
|
65
|
+
end
|
66
|
+
|
67
|
+
def que_version
|
68
|
+
@que_version ||= Gem.loaded_specs["que"].version.to_s
|
65
69
|
end
|
66
70
|
|
67
71
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: que-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Lascelles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fugit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,14 +90,14 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
93
|
+
version: '5.0'
|
94
94
|
type: :development
|
95
95
|
prerelease: false
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
98
|
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: '
|
100
|
+
version: '5.0'
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
name: appraisal
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -258,14 +258,14 @@ dependencies:
|
|
258
258
|
requirements:
|
259
259
|
- - '='
|
260
260
|
- !ruby/object:Gem::Version
|
261
|
-
version:
|
261
|
+
version: 1.5.2
|
262
262
|
type: :development
|
263
263
|
prerelease: false
|
264
264
|
version_requirements: !ruby/object:Gem::Requirement
|
265
265
|
requirements:
|
266
266
|
- - '='
|
267
267
|
- !ruby/object:Gem::Version
|
268
|
-
version:
|
268
|
+
version: 1.5.2
|
269
269
|
- !ruby/object:Gem::Dependency
|
270
270
|
name: rubocop-rspec
|
271
271
|
requirement: !ruby/object:Gem::Requirement
|
@@ -376,7 +376,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
376
376
|
requirements:
|
377
377
|
- - ">="
|
378
378
|
- !ruby/object:Gem::Version
|
379
|
-
version: '
|
379
|
+
version: '2.5'
|
380
380
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
381
381
|
requirements:
|
382
382
|
- - ">="
|