resque-scheduler 4.10.2 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +3 -3
- data/.github/workflows/ruby.yml +1 -0
- data/CHANGELOG.md +16 -0
- data/README.md +2 -2
- data/lib/resque/scheduler/cli.rb +2 -1
- data/lib/resque/scheduler/configuration.rb +7 -0
- data/lib/resque/scheduler/delaying_extensions.rb +13 -15
- data/lib/resque/scheduler/env.rb +4 -0
- data/lib/resque/scheduler/lock/base.rb +1 -1
- data/lib/resque/scheduler/plugin.rb +9 -0
- data/lib/resque/scheduler/version.rb +1 -1
- data/lib/resque/scheduler.rb +10 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4ecd4f957b7c3df8c89bc85ffb8951b5df6cc18b004379b29ebcfc3be982621
|
4
|
+
data.tar.gz: 7aacc351234c1f367d8b73cda10d43b97ff26e89a3319e0afa76b51abea70430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e668259967505827e06a40a83cb2e3b7c7c165df440c914c8e688c4d871594c46ac512ebb8a99856f4e3cf37f45625f5144bc6beeda1157c7b2d146eec9055cc
|
7
|
+
data.tar.gz: 32e7b921643fb62600d133db156c5f4c28d863a893a92d18ba1b1f7317b0371dd38cd11b0a1e2adcccfa211265f9d285b452d2e524d3637487e7c982c8563032
|
@@ -31,7 +31,7 @@ jobs:
|
|
31
31
|
|
32
32
|
# Initializes the CodeQL tools for scanning.
|
33
33
|
- name: Initialize CodeQL
|
34
|
-
uses: github/codeql-action/init@
|
34
|
+
uses: github/codeql-action/init@v3
|
35
35
|
with:
|
36
36
|
languages: ${{ matrix.language }}
|
37
37
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
@@ -42,7 +42,7 @@ jobs:
|
|
42
42
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
43
43
|
# If this step fails, then you should remove it and run the build manually (see below)
|
44
44
|
- name: Autobuild
|
45
|
-
uses: github/codeql-action/autobuild@
|
45
|
+
uses: github/codeql-action/autobuild@v3
|
46
46
|
|
47
47
|
# ℹ️ Command-line programs to run using the OS shell.
|
48
48
|
# 📚 https://git.io/JvXDl
|
@@ -56,4 +56,4 @@ jobs:
|
|
56
56
|
# make release
|
57
57
|
|
58
58
|
- name: Perform CodeQL Analysis
|
59
|
-
uses: github/codeql-action/analyze@
|
59
|
+
uses: github/codeql-action/analyze@v3
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
**ATTN**: This project uses [semantic versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [4.10.3] - 2024-12-30
|
6
|
+
### Added
|
7
|
+
* Expose timeout for lock via environment variable configuration by @pmm4654 in #786
|
8
|
+
* Add Ruby 3.3 to the CI matrix by @santiagorodriguez96 in #797
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
* Fix schedule hooks when enqueuing configured job by @codealchemy in #792
|
12
|
+
* Fix undefined `header` method CI failures by @codealchemy in #793
|
13
|
+
|
14
|
+
### Documentation
|
15
|
+
* Fix typo by @dijonkitchen in #789
|
16
|
+
* Fix links to generated docs by @dijonkitchen in #790
|
17
|
+
|
18
|
+
### Security
|
19
|
+
* Bump github/codeql-action from 2 to 3 by @dependabot in #785
|
20
|
+
|
5
21
|
## [4.10.2] - 2023-12-15
|
6
22
|
### Fixed
|
7
23
|
* Finish fixing CVE-2022-44303, XSS in delayed_schedules by @PatrickTulskie in #783
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Resque.enqueue_at(5.days.from_now, SomeJob, argument) # runs a job at a specific
|
|
28
28
|
|
29
29
|
This `README` covers what most people need to know. If you're looking
|
30
30
|
for details on individual methods, you might want to try the
|
31
|
-
[
|
31
|
+
[rubydoc](https://rubydoc.info/github/resque/resque-scheduler/master/frames).
|
32
32
|
|
33
33
|
### Installation
|
34
34
|
|
@@ -86,7 +86,7 @@ namespace :resque do
|
|
86
86
|
# If your schedule already has +queue+ set for each job, you don't
|
87
87
|
# need to require your jobs. This can be an advantage since it's
|
88
88
|
# less code that resque-scheduler needs to know about. But in a small
|
89
|
-
# project, it's usually easier to just include
|
89
|
+
# project, it's usually easier to just include your job classes here.
|
90
90
|
# So, something like this:
|
91
91
|
require 'jobs'
|
92
92
|
end
|
data/lib/resque/scheduler/cli.rb
CHANGED
@@ -80,6 +80,13 @@ module Resque
|
|
80
80
|
Float(environment.fetch('RESQUE_SCHEDULER_INTERVAL', '5'))
|
81
81
|
end
|
82
82
|
|
83
|
+
# Sets timeout for Resque::Scheduler::Lock::Base
|
84
|
+
attr_writer :lock_timeout
|
85
|
+
|
86
|
+
def lock_timeout
|
87
|
+
@lock_timeout ||= environment.fetch('LOCK_TIMEOUT', 60 * 3).to_i
|
88
|
+
end
|
89
|
+
|
83
90
|
private
|
84
91
|
|
85
92
|
# Copied from https://github.com/rails/rails/blob/main/activemodel/lib/active_model/type/boolean.rb#L17
|
@@ -22,24 +22,22 @@ module Resque
|
|
22
22
|
# timestamp has passed. It respects Resque.inline option, by
|
23
23
|
# creating the job right away instead of adding to the queue.
|
24
24
|
def enqueue_at_with_queue(queue, timestamp, klass, *args)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
plugin.process_schedule_hooks(klass, *args) do
|
26
|
+
if Resque.inline? || timestamp.to_i <= Time.now.to_i
|
27
|
+
# Just create the job and let resque perform it right away with
|
28
|
+
# inline. If the class is a custom job class, call self#scheduled
|
29
|
+
# on it. This allows you to do things like
|
30
|
+
# Resque.enqueue_at(timestamp, CustomJobClass, :opt1 => val1).
|
31
|
+
# Otherwise, pass off to Resque.
|
32
|
+
if klass.respond_to?(:scheduled)
|
33
|
+
klass.scheduled(queue, klass.to_s, *args)
|
34
|
+
else
|
35
|
+
Resque.enqueue_to(queue, klass, *args)
|
36
|
+
end
|
35
37
|
else
|
36
|
-
|
38
|
+
delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))
|
37
39
|
end
|
38
|
-
else
|
39
|
-
delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))
|
40
40
|
end
|
41
|
-
|
42
|
-
plugin.run_after_schedule_hooks(klass, *args)
|
43
41
|
end
|
44
42
|
|
45
43
|
# Identical to enqueue_at but takes number_of_seconds_from_now
|
data/lib/resque/scheduler/env.rb
CHANGED
@@ -54,6 +54,7 @@ module Resque
|
|
54
54
|
at_exit { cleanup_pid_file }
|
55
55
|
end
|
56
56
|
|
57
|
+
# rubocop:disable Metrics/AbcSize
|
57
58
|
def setup_scheduler_configuration
|
58
59
|
Resque::Scheduler.configure do |c|
|
59
60
|
c.app_name = options[:app_name] if options.key?(:app_name)
|
@@ -66,6 +67,8 @@ module Resque
|
|
66
67
|
|
67
68
|
c.logformat = options[:logformat] if options.key?(:logformat)
|
68
69
|
|
70
|
+
c.lock_timeout = options[:lock_timeout] if options.key?(:lock_timeout)
|
71
|
+
|
69
72
|
if (psleep = options[:poll_sleep_amount]) && !psleep.nil?
|
70
73
|
c.poll_sleep_amount = Float(psleep)
|
71
74
|
end
|
@@ -73,6 +76,7 @@ module Resque
|
|
73
76
|
c.verbose = !!options[:verbose] if options.key?(:verbose)
|
74
77
|
end
|
75
78
|
end
|
79
|
+
# rubocop:enable Metrics/AbcSize
|
76
80
|
|
77
81
|
def cleanup_pid_file
|
78
82
|
return unless pidfile_path
|
@@ -3,6 +3,15 @@
|
|
3
3
|
module Resque
|
4
4
|
module Scheduler
|
5
5
|
module Plugin
|
6
|
+
def self.process_schedule_hooks(klass, *args)
|
7
|
+
# the documentation states that if any before_schedule hook returns
|
8
|
+
# false, the process should not be enqueued
|
9
|
+
return unless run_before_schedule_hooks(klass, *args)
|
10
|
+
|
11
|
+
yield
|
12
|
+
run_after_schedule_hooks(klass, *args)
|
13
|
+
end
|
14
|
+
|
6
15
|
def self.hooks(job, pattern)
|
7
16
|
job.methods.grep(/^#{pattern}/).sort
|
8
17
|
end
|
data/lib/resque/scheduler.rb
CHANGED
@@ -331,17 +331,16 @@ module Resque
|
|
331
331
|
# for non-existent classes (for example: running scheduler in
|
332
332
|
# one app that schedules for another.
|
333
333
|
if Class === klass
|
334
|
-
Resque::Scheduler::Plugin.
|
335
|
-
klass, *params
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
Resque.enqueue_to(queue, klass, *params)
|
334
|
+
Resque::Scheduler::Plugin.process_schedule_hooks(klass, *params) do
|
335
|
+
Resque::Scheduler::Plugin.run_before_delayed_enqueue_hooks(klass, *params)
|
336
|
+
# If the class is a custom job class, call self#scheduled on it.
|
337
|
+
# This allows you to do things like Resque.enqueue_at(timestamp,
|
338
|
+
# CustomJobClass). Otherwise, pass off to Resque.
|
339
|
+
if klass.respond_to?(:scheduled)
|
340
|
+
klass.scheduled(queue, klass_name, *params)
|
341
|
+
else
|
342
|
+
Resque.enqueue_to(queue, klass, *params)
|
343
|
+
end
|
345
344
|
end
|
346
345
|
else
|
347
346
|
# This will not run the before_hooks in rescue, but will at least
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben VandenBos
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: exe
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2024-12-30 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|