que-scheduler 4.2.0 → 4.3.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/README.md +12 -2
- data/lib/que/scheduler/defined_job.rb +1 -1
- data/lib/que/scheduler/migrations/7/down.sql +13 -0
- data/lib/que/scheduler/migrations/7/up.sql +13 -0
- data/lib/que/scheduler/schedule.rb +3 -4
- data/lib/que/scheduler/to_enqueue.rb +3 -3
- data/lib/que/scheduler/version.rb +1 -1
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3031c76424c60291dc8d004538ab6dc5d57fdf8bb7c48faa6dae2cd2ddba90f7
|
4
|
+
data.tar.gz: 0c3d33ade4ebce0c2e24414347da1a5150d5ba680adafa240a15475a71ba646b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6c0bdefa899496a741b4c4b059cdc7663299a4a349b41560c44d77d2c788bc3ee4fb53f7c8fa51767d86332f1bd5475ea3bca3516ddd1a81de1bfea91e2e653
|
7
|
+
data.tar.gz: 447ff26a1c104803e27da593730b77aaf59300e13ead005c7dece366c1fbc0f252d65524dcba6b6a64be2a656681a97e1ae78adb45117b374b533525e2612b6a
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ resque-scheduler files, but with additional features.
|
|
27
27
|
```ruby
|
28
28
|
class CreateQueSchedulerSchema < ActiveRecord::Migration
|
29
29
|
def change
|
30
|
-
Que::Scheduler::Migrations.migrate!(version:
|
30
|
+
Que::Scheduler::Migrations.migrate!(version: 7)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
```
|
@@ -211,7 +211,7 @@ performed.
|
|
211
211
|
```ruby
|
212
212
|
class CreateQueSchedulerSchema < ActiveRecord::Migration
|
213
213
|
def change
|
214
|
-
Que::Scheduler::Migrations.migrate!(version:
|
214
|
+
Que::Scheduler::Migrations.migrate!(version: 7)
|
215
215
|
end
|
216
216
|
end
|
217
217
|
```
|
@@ -310,6 +310,15 @@ A full changelog can be found here: [CHANGELOG.md](https://github.com/hlascelles
|
|
310
310
|
|
311
311
|
Your [postgres](https://www.postgresql.org/) database must be at least version 9.5.0.
|
312
312
|
|
313
|
+
The latest version of que-scheduler supports Ruby 2.7, though this is largely to allow
|
314
|
+
the gem to work with que 2.x. Recent que-scheduler versions (up to 4.2.2) work with Ruby 2.5.
|
315
|
+
|
316
|
+
Ruby 3.x support (and thus que 2.x support) is currently in beta.
|
317
|
+
|
318
|
+
Using que 0.x with Rails 6 needs a patch to support it.
|
319
|
+
See the patch and how to use it here: https://github.com/que-rb/que/issues/247#issuecomment-595258236
|
320
|
+
If that patch is included then que-scheduler will work. This setup is tested, but is not supported.
|
321
|
+
|
313
322
|
## Inspiration
|
314
323
|
|
315
324
|
This gem was inspired by the makers of the excellent [Que](https://github.com/chanks/que) job scheduler gem.
|
@@ -324,3 +333,4 @@ This gem was inspired by the makers of the excellent [Que](https://github.com/ch
|
|
324
333
|
* @krzyzak
|
325
334
|
* @papodaca
|
326
335
|
* @ajoneil
|
336
|
+
* @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
|
@@ -0,0 +1,13 @@
|
|
1
|
+
CREATE OR REPLACE FUNCTION que_scheduler_prevent_job_deletion() RETURNS TRIGGER AS
|
2
|
+
$BODY$
|
3
|
+
DECLARE
|
4
|
+
BEGIN
|
5
|
+
IF OLD.job_class = 'Que::Scheduler::SchedulerJob' THEN
|
6
|
+
IF NOT que_scheduler_check_job_exists() THEN
|
7
|
+
raise exception 'Deletion of que_scheduler job % prevented. Deleting the que_scheduler job is almost certainly a mistake.', OLD.job_id;
|
8
|
+
END IF;
|
9
|
+
END IF;
|
10
|
+
RETURN OLD;
|
11
|
+
END;
|
12
|
+
$BODY$
|
13
|
+
LANGUAGE 'plpgsql';
|
@@ -0,0 +1,13 @@
|
|
1
|
+
CREATE OR REPLACE FUNCTION que_scheduler_prevent_job_deletion() RETURNS TRIGGER AS
|
2
|
+
$BODY$
|
3
|
+
DECLARE
|
4
|
+
BEGIN
|
5
|
+
IF OLD.job_class = 'Que::Scheduler::SchedulerJob' THEN
|
6
|
+
IF NOT que_scheduler_check_job_exists() THEN
|
7
|
+
raise exception 'Deletion of que_scheduler job prevented. Deleting the que_scheduler job is almost certainly a mistake.';
|
8
|
+
END IF;
|
9
|
+
END IF;
|
10
|
+
RETURN OLD;
|
11
|
+
END;
|
12
|
+
$BODY$
|
13
|
+
LANGUAGE 'plpgsql';
|
@@ -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
|
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)
|
@@ -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.3.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: 2022-
|
11
|
+
date: 2022-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,20 +70,20 @@ dependencies:
|
|
70
70
|
requirements:
|
71
71
|
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '0.
|
73
|
+
version: '0.14'
|
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
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0.
|
83
|
+
version: '0.14'
|
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
|
@@ -371,6 +371,8 @@ files:
|
|
371
371
|
- lib/que/scheduler/migrations/5/up.sql
|
372
372
|
- lib/que/scheduler/migrations/6/down.sql
|
373
373
|
- lib/que/scheduler/migrations/6/up.sql
|
374
|
+
- lib/que/scheduler/migrations/7/down.sql
|
375
|
+
- lib/que/scheduler/migrations/7/up.sql
|
374
376
|
- lib/que/scheduler/schedule.rb
|
375
377
|
- lib/que/scheduler/scheduler_job.rb
|
376
378
|
- lib/que/scheduler/scheduler_job_args.rb
|
@@ -388,6 +390,7 @@ metadata:
|
|
388
390
|
changelog_uri: https://github.com/hlascelles/que-scheduler/blob/master/CHANGELOG.md
|
389
391
|
source_code_uri: https://github.com/hlascelles/que-scheduler/
|
390
392
|
bug_tracker_uri: https://github.com/hlascelles/que-scheduler/issues
|
393
|
+
rubygems_mfa_required: 'true'
|
391
394
|
post_install_message:
|
392
395
|
rdoc_options: []
|
393
396
|
require_paths:
|
@@ -396,14 +399,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
396
399
|
requirements:
|
397
400
|
- - ">="
|
398
401
|
- !ruby/object:Gem::Version
|
399
|
-
version: '
|
402
|
+
version: '2.7'
|
400
403
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
401
404
|
requirements:
|
402
405
|
- - ">="
|
403
406
|
- !ruby/object:Gem::Version
|
404
407
|
version: '0'
|
405
408
|
requirements: []
|
406
|
-
rubygems_version: 3.
|
409
|
+
rubygems_version: 3.1.6
|
407
410
|
signing_key:
|
408
411
|
specification_version: 4
|
409
412
|
summary: A cron scheduler for Que
|