resque-scheduler 4.10.2 → 5.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cf8e385c64ab6efafcc8f3a499ec2dc8d7be736604e7d4578dd356f1c19d6e9
4
- data.tar.gz: a564652590bf3c5dc85695cbbb57fb4ca85873de78c94f0580a104ef5d98cf55
3
+ metadata.gz: e23e91d3c9920396d8feaad257fe4a27f4ff269f6cd0d6f9756016599d7cdf27
4
+ data.tar.gz: 7c1c242fd5c2ed74f8c15924d476775f76ed4929fb65d31b965e708c5949a601
5
5
  SHA512:
6
- metadata.gz: 2ab0cea69751963f68055eae115c349a885439a5b33c1c3046a5abd4fc30b676233964d430fa5aeb3eb7960d9339772d41ca31c575156eb4e6583cc66de7497e
7
- data.tar.gz: f0a4ab726ea640f9df76bbb824078252fb90de9d40c90220611c71069363025933f4a97200c73c13c7c91ff4f02a8c64c735372bbd2e0510e4e5bd021ec081fb
6
+ metadata.gz: c90721652b59bdc1f2572975d3ef93ed9aa420f36a6a8f3a0c5a35f17a3e5145ebdd30bfacf7d62e4903f9477319282c8a33d55080f5c870c84161f4933e79d4
7
+ data.tar.gz: 061fc1d3dfea48a20db7e8c11b31fe0b2e6594d9be0ed5c202c38f304941bceb8c1f15497d0c0ec886c0ddd37fc867b6dd1b5e143e9bb5961cd01b41f73d2e5e
@@ -0,0 +1,42 @@
1
+ # Use Ruby 3.3 as specified in the test matrix
2
+ FROM ruby:3.3
3
+
4
+ # Install dependencies
5
+ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6
+ && apt-get -y install --no-install-recommends \
7
+ git \
8
+ build-essential \
9
+ libssl-dev \
10
+ libreadline-dev \
11
+ zlib1g-dev \
12
+ redis-tools \
13
+ && apt-get clean \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Create a non-root user
17
+ ARG USERNAME=vscode
18
+ ARG USER_UID=1000
19
+ ARG USER_GID=$USER_UID
20
+
21
+ RUN groupadd --gid $USER_GID $USERNAME \
22
+ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
23
+ && apt-get update \
24
+ && apt-get install -y sudo \
25
+ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
26
+ && chmod 0440 /etc/sudoers.d/$USERNAME
27
+
28
+ # Set the default user
29
+ USER $USERNAME
30
+
31
+ # Set working directory
32
+ WORKDIR /workspaces/resque-scheduler
33
+
34
+ # Install bundler
35
+ RUN gem install bundler
36
+
37
+ # Set environment variables for the test matrix configuration
38
+ ENV REDIS_VERSION=latest
39
+ ENV RESQUE=master
40
+ ENV RUFUS_SCHEDULER=3.6
41
+ ENV RACK_VERSION=3
42
+ ENV COVERAGE=1
@@ -0,0 +1,111 @@
1
+ # Dev Container for Resque Scheduler
2
+
3
+ This dev container is configured to match the GitHub Actions test matrix with the following configuration:
4
+
5
+ - **Ruby version**: 3.3
6
+ - **Resque version**: master (from git)
7
+ - **Rufus-scheduler**: 3.6
8
+ - **Redis version**: latest
9
+ - **Rack version**: 3
10
+
11
+ ## Getting Started
12
+
13
+ 1. Open this repository in VS Code
14
+ 2. When prompted, click "Reopen in Container" (or run the command "Dev Containers: Reopen in Container")
15
+ 3. Wait for the container to build and start
16
+ 4. Once inside the container, dependencies will be automatically installed via `bundle install`
17
+
18
+ ## Running Tests
19
+
20
+ To run the full test suite:
21
+
22
+ ```bash
23
+ bundle exec rake
24
+ ```
25
+
26
+ To run a specific test file:
27
+
28
+ ```bash
29
+ bundle exec ruby test/scheduler_test.rb
30
+ ```
31
+
32
+ To run tests with verbose output:
33
+
34
+ ```bash
35
+ VERBOSE=1 bundle exec rake
36
+ ```
37
+
38
+ To run tests matching a specific pattern:
39
+
40
+ ```bash
41
+ PATTERN='test/scheduler_*_test.rb' bundle exec rake
42
+ ```
43
+
44
+ ## Testing with Different Configurations
45
+
46
+ If you want to test with different versions, you can modify the environment variables and reinstall dependencies:
47
+
48
+ ```bash
49
+ # Example: Test with rufus-scheduler 3.4
50
+ export RUFUS_SCHEDULER=3.4
51
+ bundle install
52
+
53
+ # Run tests
54
+ bundle exec rake
55
+
56
+ # Reset to original configuration
57
+ export RUFUS_SCHEDULER=3.6
58
+ bundle install
59
+ ```
60
+
61
+ ## Available Environment Variables
62
+
63
+ The following environment variables are set to match the test matrix:
64
+
65
+ - `REDIS_VERSION`: latest
66
+ - `RESQUE`: master
67
+ - `RUFUS_SCHEDULER`: 3.6
68
+ - `RACK_VERSION`: 3
69
+ - `COVERAGE`: 1
70
+
71
+ ## Services
72
+
73
+ ### Redis
74
+ Redis is available at `redis://redis:6379` or via `localhost:6379` from within the container.
75
+
76
+ To connect to Redis CLI:
77
+
78
+ ```bash
79
+ redis-cli -h redis
80
+ ```
81
+
82
+ ## Troubleshooting
83
+
84
+ ### Bundle Install Issues
85
+
86
+ If you encounter issues with bundle install, try:
87
+
88
+ ```bash
89
+ bundle config set --local build.redis --with-cflags="-Wno-error=implicit-function-declaration"
90
+ bundle install
91
+ ```
92
+
93
+ ### Redis Connection Issues
94
+
95
+ Make sure Redis is running:
96
+
97
+ ```bash
98
+ redis-cli -h redis ping
99
+ ```
100
+
101
+ Should return `PONG`.
102
+
103
+ ### Rebuilding the Container
104
+
105
+ If you need to rebuild the container from scratch:
106
+
107
+ 1. Run "Dev Containers: Rebuild Container" from the command palette
108
+ 2. Or delete the container and volume manually:
109
+ ```bash
110
+ docker-compose -f .devcontainer/docker-compose.yml down -v
111
+ ```
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "Resque Scheduler Dev Container",
3
+ "dockerComposeFile": "docker-compose.yml",
4
+ "service": "app",
5
+ "workspaceFolder": "/workspaces/resque-scheduler",
6
+
7
+ // Features to add to the dev container
8
+ "features": {
9
+ "ghcr.io/devcontainers/features/git:1": {}
10
+ },
11
+
12
+ // Configure tool-specific properties
13
+ "customizations": {
14
+ "vscode": {
15
+ "extensions": [
16
+ "rebornix.ruby"
17
+ ],
18
+ "settings": {
19
+ "terminal.integrated.defaultProfile.linux": "bash"
20
+ }
21
+ }
22
+ },
23
+
24
+ // Use 'forwardPorts' to make a list of ports inside the container available locally
25
+ "forwardPorts": [6379],
26
+
27
+ // Use 'postCreateCommand' to run commands after the container is created
28
+ "postCreateCommand": "bundle install",
29
+
30
+ // Set environment variables for the test matrix
31
+ "containerEnv": {
32
+ "REDIS_VERSION": "latest",
33
+ "RESQUE": "master",
34
+ "RUFUS_SCHEDULER": "3.6",
35
+ "RACK_VERSION": "3",
36
+ "COVERAGE": "1"
37
+ },
38
+
39
+ // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root
40
+ "remoteUser": "vscode"
41
+ }
@@ -0,0 +1,31 @@
1
+ services:
2
+ app:
3
+ build:
4
+ context: .
5
+ dockerfile: Dockerfile
6
+ volumes:
7
+ - ../..:/workspaces:cached
8
+ working_dir: /workspaces/resque-scheduler
9
+ command: sleep infinity
10
+ environment:
11
+ REDIS_VERSION: "latest"
12
+ RESQUE: "master"
13
+ RUFUS_SCHEDULER: "3.6"
14
+ RACK_VERSION: "3"
15
+ COVERAGE: "1"
16
+ REDIS_URL: "redis://redis:6379"
17
+ depends_on:
18
+ - redis
19
+ # Runs app on the same network as the redis container, allows "forwardPorts" in devcontainer.json function
20
+ network_mode: service:redis
21
+
22
+ redis:
23
+ image: redis:latest
24
+ restart: unless-stopped
25
+ ports:
26
+ - "6379:6379"
27
+ volumes:
28
+ - redis-data:/data
29
+
30
+ volumes:
31
+ redis-data:
@@ -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@v2
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@v2
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@v2
59
+ uses: github/codeql-action/analyze@v3
@@ -14,7 +14,7 @@ jobs:
14
14
  matrix:
15
15
  os: [ubuntu-latest]
16
16
  ruby: [
17
- 2.7
17
+ 3.4
18
18
  ]
19
19
 
20
20
  steps:
@@ -19,56 +19,29 @@ jobs:
19
19
  fail-fast: false
20
20
  matrix:
21
21
  ruby-version:
22
- - 2.3
23
- - 2.4
24
- - 2.5
25
- - 2.6
26
- - 2.7
27
22
  - "3.0"
28
23
  - 3.1
29
24
  - 3.2
25
+ - 3.3
26
+ - 3.4
27
+ - head
30
28
  resque-version:
31
29
  - "master"
32
- - "~> 2.4.0"
33
- - "~> 1.27"
34
30
  rufus-scheduler:
35
- - "3.2"
36
31
  - "3.4"
37
32
  - "3.5"
38
33
  - "3.6"
39
34
  redis-version:
40
- - "~> 4.x"
41
- - "~> 5.x"
42
- exclude:
43
- - ruby-version: head
44
- rufus-scheduler: 3.2
45
- - ruby-version: 3.2
46
- rufus-scheduler: 3.2
47
-
48
- - ruby-version: 2.3
49
- resque-version: "~> 1.27"
50
- rufus-scheduler: 3.4
51
- - ruby-version: 2.3
52
- resque-version: "~> 1.27"
53
- rufus-scheduler: 3.5
54
- - ruby-version: 2.5
55
- resque-version: "~> 2.4.0"
56
- rufus-scheduler: 3.5
57
- - ruby-version: 2.5
58
- resque-version: master
59
- rufus-scheduler: 3.2
60
-
61
- - ruby-version: 2.3
62
- redis-version: "~> 5.x"
63
- - ruby-version: 2.4
64
- redis-version: "~> 5.x"
65
-
66
- - resque-version: "~> 1.27"
67
- redis-version: "~> 5.x"
35
+ - "4.8"
36
+ - "latest"
37
+ rack-version:
38
+ - 2
39
+ - 3
68
40
  env:
69
41
  REDIS_VERSION: "${{ matrix.redis-version }}"
70
42
  RESQUE: "${{ matrix.resque-version }}"
71
43
  RUFUS_SCHEDULER: "${{ matrix.rufus-scheduler }}"
44
+ RACK_VERSION: "${{ matrix.rack-version }}"
72
45
  COVERAGE: 1
73
46
 
74
47
  steps:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,52 @@
2
2
 
3
3
  **ATTN**: This project uses [semantic versioning](http://semver.org/).
4
4
 
5
+ ## [5.0.0] - 2026-01-15
6
+ ### Breaking Changes
7
+ * Ruby requirement: `>= 2.3.0` → `>= 3.0.0`
8
+ * Resque dependency: `>= 1.27` → `>= 3.0`
9
+ * Redis dependency: `>= 3.3` → `>= 4.0`
10
+ * Removed `rack < 3` constraint
11
+
12
+ ### Added
13
+ * Add Ruby 3.4 to the CI matrix by @and9000 in #804
14
+ * Added `base64 ~> 0.1` runtime dependency (Ruby 3.4+ compatibility) by @PatrickTulskie in #809
15
+ * Added `irb` dev dependency (Ruby 4+ compatibility) by @PatrickTulskie in #809
16
+ * Added Rack 2/3 matrix testing by @PatrickTulskie in #809
17
+
18
+ ### Changed
19
+ * Prepare for resque 3.0 compatibility by @PatrickTulskie in #809
20
+ * CI now tests Ruby 3.0-3.4 + head only (removed Ruby 2.x)
21
+ * Simplified to test against resque master only
22
+ * Modernized `.rubocop.yml` to `DisabledByDefault: true` approach
23
+ * Set `TargetRubyVersion: 3.0`
24
+ * Updated rubocop: `~> 0.40.0` → `~> 0.80`
25
+ * Use `JSON.parse` instead of `JSON.load` (security improvement) by @PatrickTulskie in #809
26
+ * Use `URI.decode_www_form_component` instead of `CGI.unescape` by @PatrickTulskie in #809
27
+ * Consistent time formatting in views by @PatrickTulskie in #809
28
+
29
+ ### Fixed
30
+ * Fix `Resque::Scheduler.print_schedule` by @codealchemy in #794
31
+ * Remove circular require for resque from resque-scheduler by @zzak in #795
32
+ * Fixed test compatibility with Rack 3 by @PatrickTulskie in #809
33
+ * Fixed race condition in scheduler task tests by @PatrickTulskie in #809
34
+
35
+ ## [4.10.3] - 2024-12-30
36
+ ### Added
37
+ * Expose timeout for lock via environment variable configuration by @pmm4654 in #786
38
+ * Add Ruby 3.3 to the CI matrix by @santiagorodriguez96 in #797
39
+
40
+ ### Fixed
41
+ * Fix schedule hooks when enqueuing configured job by @codealchemy in #792
42
+ * Fix undefined `header` method CI failures by @codealchemy in #793
43
+
44
+ ### Documentation
45
+ * Fix typo by @dijonkitchen in #789
46
+ * Fix links to generated docs by @dijonkitchen in #790
47
+
48
+ ### Security
49
+ * Bump github/codeql-action from 2 to 3 by @dependabot in #785
50
+
5
51
  ## [4.10.2] - 2023-12-15
6
52
  ### Fixed
7
53
  * Finish fixing CVE-2022-44303, XSS in delayed_schedules by @PatrickTulskie in #783
data/Gemfile CHANGED
@@ -24,6 +24,13 @@ else
24
24
  gem 'redis', redis_version
25
25
  end
26
26
 
27
+ rack_version = ENV.fetch('RACK_VERSION', '3')
28
+ gem 'rack', "~> #{rack_version}.0"
29
+
30
+ if rack_version.to_i >= 3
31
+ gem 'rackup'
32
+ end
33
+
27
34
  gem 'sinatra', '> 2.0'
28
35
 
29
36
  gemspec
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
- [rdoc](http://rdoc.info/github/resque/resque-scheduler/master/frames).
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 you job classes here.
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
@@ -15,7 +15,8 @@ module Resque
15
15
  quiet: 'QUIET',
16
16
  pidfile: 'PIDFILE',
17
17
  poll_sleep_amount: 'RESQUE_SCHEDULER_INTERVAL',
18
- verbose: 'VERBOSE'
18
+ verbose: 'VERBOSE',
19
+ lock_timeout: 'LOCK_TIMEOUT'
19
20
  }.freeze
20
21
 
21
22
  class Cli
@@ -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
@@ -1,5 +1,4 @@
1
1
  # vim:fileencoding=utf-8
2
- require 'resque'
3
2
  require_relative 'plugin'
4
3
  require_relative '../scheduler'
5
4
 
@@ -22,24 +21,22 @@ module Resque
22
21
  # timestamp has passed. It respects Resque.inline option, by
23
22
  # creating the job right away instead of adding to the queue.
24
23
  def enqueue_at_with_queue(queue, timestamp, klass, *args)
25
- return false unless plugin.run_before_schedule_hooks(klass, *args)
26
-
27
- if Resque.inline? || timestamp.to_i <= Time.now.to_i
28
- # Just create the job and let resque perform it right away with
29
- # inline. If the class is a custom job class, call self#scheduled
30
- # on it. This allows you to do things like
31
- # Resque.enqueue_at(timestamp, CustomJobClass, :opt1 => val1).
32
- # Otherwise, pass off to Resque.
33
- if klass.respond_to?(:scheduled)
34
- klass.scheduled(queue, klass.to_s, *args)
24
+ plugin.process_schedule_hooks(klass, *args) do
25
+ if Resque.inline? || timestamp.to_i <= Time.now.to_i
26
+ # Just create the job and let resque perform it right away with
27
+ # inline. If the class is a custom job class, call self#scheduled
28
+ # on it. This allows you to do things like
29
+ # Resque.enqueue_at(timestamp, CustomJobClass, :opt1 => val1).
30
+ # Otherwise, pass off to Resque.
31
+ if klass.respond_to?(:scheduled)
32
+ klass.scheduled(queue, klass.to_s, *args)
33
+ else
34
+ Resque.enqueue_to(queue, klass, *args)
35
+ end
35
36
  else
36
- Resque.enqueue_to(queue, klass, *args)
37
+ delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))
37
38
  end
38
- else
39
- delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))
40
39
  end
41
-
42
- plugin.run_after_schedule_hooks(klass, *args)
43
40
  end
44
41
 
45
42
  # Identical to enqueue_at but takes number_of_seconds_from_now
@@ -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
@@ -11,7 +11,7 @@ module Resque
11
11
  @key = key
12
12
 
13
13
  # 3 minute default timeout
14
- @timeout = options[:timeout] || 60 * 3
14
+ @timeout = options[:timeout] || Resque::Scheduler.lock_timeout
15
15
  end
16
16
 
17
17
  # Attempts to acquire the lock. Returns true if successfully acquired.
@@ -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
@@ -8,7 +8,7 @@
8
8
  <% @timestamps.each do |t| %>
9
9
  <tr>
10
10
  <td>
11
- <%= Time.at(t) %>
11
+ <%= format_time(Time.at(t)) %>
12
12
  </td>
13
13
  </tr>
14
14
  <% end %>
@@ -87,9 +87,11 @@ module Resque
87
87
  def delayed_jobs_klass
88
88
  begin
89
89
  klass = Resque::Scheduler::Util.constantize(params[:klass])
90
- @args = JSON.load(CGI.unescape(params[:args]))
90
+ args_param = params[:args] || params['args']
91
+ @args = args_param ? JSON.parse(URI.decode_www_form_component(args_param)) : []
91
92
  @timestamps = Resque.scheduled_at(klass, *@args)
92
93
  rescue
94
+ @args = []
93
95
  @timestamps = []
94
96
  end
95
97
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Resque
4
4
  module Scheduler
5
- VERSION = '4.10.2'.freeze
5
+ VERSION = '5.0.0'.freeze
6
6
  end
7
7
  end
@@ -86,8 +86,8 @@ module Resque
86
86
  if rufus_scheduler
87
87
  log! "Scheduling Info\tLast Run"
88
88
  scheduler_jobs = rufus_scheduler.jobs
89
- scheduler_jobs.each do |_k, v|
90
- log! "#{v.t}\t#{v.last}\t"
89
+ scheduler_jobs.each do |job|
90
+ log! "#{job.opts}\t#{job.last_time}\t"
91
91
  end
92
92
  end
93
93
  end
@@ -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.run_before_delayed_enqueue_hooks(
335
- klass, *params
336
- )
337
-
338
- # If the class is a custom job class, call self#scheduled on it.
339
- # This allows you to do things like Resque.enqueue_at(timestamp,
340
- # CustomJobClass). Otherwise, pass off to Resque.
341
- if klass.respond_to?(:scheduled)
342
- klass.scheduled(queue, klass_name, *params)
343
- else
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
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.license = 'MIT'
33
33
  spec.metadata['rubygems_mfa_required'] = 'true'
34
34
 
35
- spec.required_ruby_version = '>= 2.3.0'
35
+ spec.required_ruby_version = '>= 3.0.0'
36
36
 
37
37
  spec.files = `git ls-files -z`.split("\0").reject do |f|
38
38
  f.match(%r{^(test|spec|features|examples|bin|tasks)/}) ||
@@ -45,8 +45,10 @@ Gem::Specification.new do |spec|
45
45
 
46
46
  spec.add_development_dependency 'bundler'
47
47
  spec.add_development_dependency 'json'
48
+ spec.add_development_dependency 'irb'
48
49
  spec.add_development_dependency 'minitest'
49
50
  spec.add_development_dependency 'mocha'
51
+ spec.add_development_dependency 'ostruct'
50
52
  spec.add_development_dependency 'pry'
51
53
  spec.add_development_dependency 'rack-test'
52
54
  spec.add_development_dependency 'rake'
@@ -57,11 +59,13 @@ Gem::Specification.new do |spec|
57
59
 
58
60
  # We pin rubocop because new cops have a tendency to result in false-y
59
61
  # positives for new contributors, which is not a nice experience.
60
- spec.add_development_dependency 'rubocop', '~> 0.40.0'
62
+ spec.add_development_dependency 'rubocop', '~> 0.80'
61
63
 
64
+ spec.add_runtime_dependency 'base64', '~> 0.1'
65
+ spec.add_runtime_dependency 'logger'
62
66
  spec.add_runtime_dependency 'mono_logger', '~> 1.0'
63
- spec.add_runtime_dependency 'redis', '>= 3.3'
64
- spec.add_runtime_dependency 'resque', '>= 1.27'
67
+ spec.add_runtime_dependency 'redis', '>= 4.0'
68
+ spec.add_runtime_dependency 'resque', '>= 3.0'
65
69
  # rufus-scheduler v3.7 causes a failure in test/multi_process_test.rb
66
70
  # rufus-scheduler v3.3 is missing a to_local method which fails tests
67
71
  spec.add_runtime_dependency 'rufus-scheduler', '~> 3.2', '!= 3.3'
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.10.2
4
+ version: 5.0.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: 2023-12-15 00:00:00.000000000 Z
16
+ date: 2026-01-15 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -43,6 +43,20 @@ dependencies:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: irb
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ type: :development
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
46
60
  - !ruby/object:Gem::Dependency
47
61
  name: minitest
48
62
  requirement: !ruby/object:Gem::Requirement
@@ -71,6 +85,20 @@ dependencies:
71
85
  - - ">="
72
86
  - !ruby/object:Gem::Version
73
87
  version: '0'
88
+ - !ruby/object:Gem::Dependency
89
+ name: ostruct
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
74
102
  - !ruby/object:Gem::Dependency
75
103
  name: pry
76
104
  requirement: !ruby/object:Gem::Requirement
@@ -175,14 +203,42 @@ dependencies:
175
203
  requirements:
176
204
  - - "~>"
177
205
  - !ruby/object:Gem::Version
178
- version: 0.40.0
206
+ version: '0.80'
179
207
  type: :development
180
208
  prerelease: false
181
209
  version_requirements: !ruby/object:Gem::Requirement
182
210
  requirements:
183
211
  - - "~>"
184
212
  - !ruby/object:Gem::Version
185
- version: 0.40.0
213
+ version: '0.80'
214
+ - !ruby/object:Gem::Dependency
215
+ name: base64
216
+ requirement: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - "~>"
219
+ - !ruby/object:Gem::Version
220
+ version: '0.1'
221
+ type: :runtime
222
+ prerelease: false
223
+ version_requirements: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - "~>"
226
+ - !ruby/object:Gem::Version
227
+ version: '0.1'
228
+ - !ruby/object:Gem::Dependency
229
+ name: logger
230
+ requirement: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - ">="
233
+ - !ruby/object:Gem::Version
234
+ version: '0'
235
+ type: :runtime
236
+ prerelease: false
237
+ version_requirements: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - ">="
240
+ - !ruby/object:Gem::Version
241
+ version: '0'
186
242
  - !ruby/object:Gem::Dependency
187
243
  name: mono_logger
188
244
  requirement: !ruby/object:Gem::Requirement
@@ -203,28 +259,28 @@ dependencies:
203
259
  requirements:
204
260
  - - ">="
205
261
  - !ruby/object:Gem::Version
206
- version: '3.3'
262
+ version: '4.0'
207
263
  type: :runtime
208
264
  prerelease: false
209
265
  version_requirements: !ruby/object:Gem::Requirement
210
266
  requirements:
211
267
  - - ">="
212
268
  - !ruby/object:Gem::Version
213
- version: '3.3'
269
+ version: '4.0'
214
270
  - !ruby/object:Gem::Dependency
215
271
  name: resque
216
272
  requirement: !ruby/object:Gem::Requirement
217
273
  requirements:
218
274
  - - ">="
219
275
  - !ruby/object:Gem::Version
220
- version: '1.27'
276
+ version: '3.0'
221
277
  type: :runtime
222
278
  prerelease: false
223
279
  version_requirements: !ruby/object:Gem::Requirement
224
280
  requirements:
225
281
  - - ">="
226
282
  - !ruby/object:Gem::Version
227
- version: '1.27'
283
+ version: '3.0'
228
284
  - !ruby/object:Gem::Dependency
229
285
  name: rufus-scheduler
230
286
  requirement: !ruby/object:Gem::Requirement
@@ -261,6 +317,10 @@ executables:
261
317
  extensions: []
262
318
  extra_rdoc_files: []
263
319
  files:
320
+ - ".devcontainer/Dockerfile"
321
+ - ".devcontainer/README.md"
322
+ - ".devcontainer/devcontainer.json"
323
+ - ".devcontainer/docker-compose.yml"
264
324
  - ".github/dependabot.yml"
265
325
  - ".github/funding.yml"
266
326
  - ".github/workflows/codeql-analysis.yml"
@@ -317,7 +377,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
377
  requirements:
318
378
  - - ">="
319
379
  - !ruby/object:Gem::Version
320
- version: 2.3.0
380
+ version: 3.0.0
321
381
  required_rubygems_version: !ruby/object:Gem::Requirement
322
382
  requirements:
323
383
  - - ">="