que-scheduler 4.1.0 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -2
- 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/migrations/6/up.sql +1 -1
- data/lib/que/scheduler/migrations.rb +1 -1
- data/lib/que/scheduler/schedule.rb +4 -5
- data/lib/que/scheduler/scheduler_job.rb +3 -3
- data/lib/que/scheduler/to_enqueue.rb +3 -3
- data/lib/que/scheduler/version.rb +1 -1
- metadata +37 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e73846d81092ac0bacd4a3c854a3610bde40c8c4a5289728f42b59a5ef7833bf
|
4
|
+
data.tar.gz: 01e41964ee78f56cf90836457a5f439d0bc5185466890e5fcbbcbe4e77306041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49bd076fb802ef81ad445d4dd668bd144a0d313aeee04988cb5bae8ebd9061955ac19c30efe46085f7453bb6dfd20f04b63c4225f6360407a46afefc8b833391
|
7
|
+
data.tar.gz: 1d4074dda7344d003140ed4b2e513702ffc8386620d236df8602a660f1fa1209d5f324d4f840bb17434b7164f5785b02d93ee4cfef08c2e055625ec675634fe8
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@ que-scheduler
|
|
2
2
|
================
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/que-scheduler.svg)](https://badge.fury.io/rb/que-scheduler)
|
5
|
-
[![Build status](https://gitlab.com/hlascelles/que-scheduler/badges/master/pipeline.svg)](https://gitlab.com/hlascelles/que-scheduler/pipelines)
|
6
5
|
[![Coverage Status](https://coveralls.io/repos/github/hlascelles/que-scheduler/badge.svg?branch=master)](https://coveralls.io/github/hlascelles/que-scheduler?branch=master)
|
7
6
|
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/710d2fc5202f95d76e8a/maintainability)](https://codeclimate.com/github/hlascelles/que-scheduler/maintainability)
|
8
7
|
|
@@ -107,7 +106,7 @@ DailyBatchReport:
|
|
107
106
|
cron: "0 3 * * *"
|
108
107
|
# This job will be run every day at 03:00 as normal.
|
109
108
|
# However, the "schedule_type: every_event" setting below will ensure that if workers are offline
|
110
|
-
# for any amount of time then the
|
109
|
+
# for any amount of time then the backlog will always be enqueued on recovery.
|
111
110
|
# See "Schedule types" below for more information.
|
112
111
|
schedule_type: every_event
|
113
112
|
```
|
@@ -311,6 +310,13 @@ A full changelog can be found here: [CHANGELOG.md](https://github.com/hlascelles
|
|
311
310
|
|
312
311
|
Your [postgres](https://www.postgresql.org/) database must be at least version 9.5.0.
|
313
312
|
|
313
|
+
Ruby 2.6 and above is supported. Ruby 2.5 currently still currently works but is unsupported.
|
314
|
+
|
315
|
+
Using que 0.x with Rails 6 needs a patch to support it.
|
316
|
+
See the patch and how to use it here: https://github.com/que-rb/que/issues/247#issuecomment-595258236
|
317
|
+
If that patch is included then que-scheduler will work. This setup is tested, but is not supported.
|
318
|
+
|
319
|
+
|
314
320
|
## Inspiration
|
315
321
|
|
316
322
|
This gem was inspired by the makers of the excellent [Que](https://github.com/chanks/que) job scheduler gem.
|
@@ -324,3 +330,5 @@ This gem was inspired by the makers of the excellent [Que](https://github.com/ch
|
|
324
330
|
* @joehorsnell
|
325
331
|
* @krzyzak
|
326
332
|
* @papodaca
|
333
|
+
* @ajoneil
|
334
|
+
* @ippachi
|
@@ -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_defined? &&
|
90
90
|
job_class < ::ActiveJob::Base &&
|
91
91
|
Que::Scheduler::ToEnqueue.active_job_version < Gem::Version.create("6.0.3")
|
92
92
|
puts <<~ERR
|
@@ -36,7 +36,7 @@ module Que
|
|
36
36
|
# This will delete all but `retain_row_count` oldest rows
|
37
37
|
count = Que::Scheduler::VersionSupport.execute(DELETE_AUDIT_SQL, [retain_row_count])
|
38
38
|
log = "#{self.class} cleared down #{count.first.fetch(:count)} rows"
|
39
|
-
::Que.log(event: "que-scheduler"
|
39
|
+
::Que.log(event: :"que-scheduler", message: log)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -13,7 +13,7 @@ DECLARE
|
|
13
13
|
BEGIN
|
14
14
|
IF OLD.job_class = 'Que::Scheduler::SchedulerJob' THEN
|
15
15
|
IF NOT que_scheduler_check_job_exists() THEN
|
16
|
-
raise exception 'Deletion of que_scheduler job
|
16
|
+
raise exception 'Deletion of que_scheduler job prevented. Deleting the que_scheduler job is almost certainly a mistake.';
|
17
17
|
END IF;
|
18
18
|
END IF;
|
19
19
|
RETURN OLD;
|
@@ -59,7 +59,7 @@ module Que
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def execute_step(number, direction)
|
62
|
-
sql =
|
62
|
+
sql = File.read("#{__dir__}/migrations/#{number}/#{direction}.sql")
|
63
63
|
Que::Scheduler::VersionSupport.execute(sql)
|
64
64
|
return unless audit_table_exists?
|
65
65
|
|
@@ -27,7 +27,7 @@ module Que
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def from_file(location)
|
30
|
-
from_yaml(
|
30
|
+
from_yaml(File.read(location))
|
31
31
|
end
|
32
32
|
|
33
33
|
def from_yaml(config)
|
@@ -36,10 +36,9 @@ module Que
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def from_hash(config_hash)
|
39
|
-
config_hash
|
40
|
-
|
41
|
-
|
42
|
-
end.to_h
|
39
|
+
config_hash
|
40
|
+
.map { |name, defined_job_hash| hash_item_to_defined_job(name.to_s, defined_job_hash) }
|
41
|
+
.index_by(&:name)
|
43
42
|
end
|
44
43
|
|
45
44
|
def hash_item_to_defined_job(name, defined_job_hash_in)
|
@@ -33,7 +33,7 @@ module Que
|
|
33
33
|
scheduler_job_args, scheduler_job_args.as_time, result.job_dictionary, enqueued_jobs
|
34
34
|
)
|
35
35
|
# Only now we're sure nothing errored, log the results
|
36
|
-
logs.each { |str| ::Que.log(event: "que-scheduler"
|
36
|
+
logs.each { |str| ::Que.log(event: :"que-scheduler", message: str) }
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -50,11 +50,11 @@ module Que
|
|
50
50
|
def check_enqueued_job(to_enqueue, enqueued_job, logs)
|
51
51
|
logs << if enqueued_job.present?
|
52
52
|
"que-scheduler enqueueing #{enqueued_job.job_class} " \
|
53
|
-
|
53
|
+
"#{enqueued_job.job_id} with args: #{enqueued_job.args}"
|
54
54
|
else
|
55
55
|
# This can happen if a middleware nixes the enqueue call
|
56
56
|
"que-scheduler called enqueue on #{to_enqueue.job_class} " \
|
57
|
-
|
57
|
+
"but it reported no job was scheduled. Has `enqueue` been overridden?"
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -22,8 +22,8 @@ module Que
|
|
22
22
|
type_from_job_class(job_class).present?
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
25
|
+
def active_job_defined?
|
26
|
+
Object.const_defined?("ActiveJob")
|
27
27
|
end
|
28
28
|
|
29
29
|
def active_job_version
|
@@ -54,7 +54,7 @@ module Que
|
|
54
54
|
hash = {
|
55
55
|
::Que::Job => QueJobType,
|
56
56
|
}
|
57
|
-
hash[::ActiveJob::Base] = ActiveJobType if ToEnqueue.
|
57
|
+
hash[::ActiveJob::Base] = ActiveJobType if ToEnqueue.active_job_defined?
|
58
58
|
hash
|
59
59
|
end
|
60
60
|
end
|
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.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Lascelles
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
version: '3'
|
54
54
|
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '6'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
version: '3'
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '6'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: que
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
version: '0.12'
|
74
74
|
- - "<="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 2.0.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -83,7 +83,7 @@ dependencies:
|
|
83
83
|
version: '0.12'
|
84
84
|
- - "<="
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
86
|
+
version: 2.0.0
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: activerecord
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,6 +91,9 @@ dependencies:
|
|
91
91
|
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '5.0'
|
94
|
+
- - "<"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '7.0'
|
94
97
|
type: :development
|
95
98
|
prerelease: false
|
96
99
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -98,6 +101,9 @@ dependencies:
|
|
98
101
|
- - ">="
|
99
102
|
- !ruby/object:Gem::Version
|
100
103
|
version: '5.0'
|
104
|
+
- - "<"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '7.0'
|
101
107
|
- !ruby/object:Gem::Dependency
|
102
108
|
name: appraisal
|
103
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,7 +147,7 @@ dependencies:
|
|
141
147
|
- !ruby/object:Gem::Version
|
142
148
|
version: '0'
|
143
149
|
- !ruby/object:Gem::Dependency
|
144
|
-
name:
|
150
|
+
name: coveralls_reborn
|
145
151
|
requirement: !ruby/object:Gem::Requirement
|
146
152
|
requirements:
|
147
153
|
- - ">="
|
@@ -210,6 +216,20 @@ dependencies:
|
|
210
216
|
- - ">="
|
211
217
|
- !ruby/object:Gem::Version
|
212
218
|
version: '0'
|
219
|
+
- !ruby/object:Gem::Dependency
|
220
|
+
name: psych
|
221
|
+
requirement: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - '='
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: 3.1.0
|
226
|
+
type: :development
|
227
|
+
prerelease: false
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - '='
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: 3.1.0
|
213
233
|
- !ruby/object:Gem::Dependency
|
214
234
|
name: rake
|
215
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,16 +276,16 @@ dependencies:
|
|
256
276
|
name: rubocop
|
257
277
|
requirement: !ruby/object:Gem::Requirement
|
258
278
|
requirements:
|
259
|
-
- -
|
279
|
+
- - ">="
|
260
280
|
- !ruby/object:Gem::Version
|
261
|
-
version:
|
281
|
+
version: '0'
|
262
282
|
type: :development
|
263
283
|
prerelease: false
|
264
284
|
version_requirements: !ruby/object:Gem::Requirement
|
265
285
|
requirements:
|
266
|
-
- -
|
286
|
+
- - ">="
|
267
287
|
- !ruby/object:Gem::Version
|
268
|
-
version:
|
288
|
+
version: '0'
|
269
289
|
- !ruby/object:Gem::Dependency
|
270
290
|
name: rubocop-rspec
|
271
291
|
requirement: !ruby/object:Gem::Requirement
|
@@ -368,7 +388,8 @@ metadata:
|
|
368
388
|
changelog_uri: https://github.com/hlascelles/que-scheduler/blob/master/CHANGELOG.md
|
369
389
|
source_code_uri: https://github.com/hlascelles/que-scheduler/
|
370
390
|
bug_tracker_uri: https://github.com/hlascelles/que-scheduler/issues
|
371
|
-
|
391
|
+
rubygems_mfa_required: 'true'
|
392
|
+
post_install_message:
|
372
393
|
rdoc_options: []
|
373
394
|
require_paths:
|
374
395
|
- lib
|
@@ -376,15 +397,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
376
397
|
requirements:
|
377
398
|
- - ">="
|
378
399
|
- !ruby/object:Gem::Version
|
379
|
-
version: '
|
400
|
+
version: '0'
|
380
401
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
381
402
|
requirements:
|
382
403
|
- - ">="
|
383
404
|
- !ruby/object:Gem::Version
|
384
405
|
version: '0'
|
385
406
|
requirements: []
|
386
|
-
rubygems_version: 3.
|
387
|
-
signing_key:
|
407
|
+
rubygems_version: 3.1.6
|
408
|
+
signing_key:
|
388
409
|
specification_version: 4
|
389
410
|
summary: A cron scheduler for Que
|
390
411
|
test_files: []
|