que-scheduler 5.0.0 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97c2b6fc33ff2ee357b0270dae679c66b50064eb8548f0e3be24c07ea504d939
4
- data.tar.gz: c1ea678b7540e3f02ac5c7eee3416d20238819eb4050bb2f3d6e7183f342022a
3
+ metadata.gz: c8e6eface6f64e6dd63dfcd340528a0624e13fc0dc5d38e7c0aeaf9a233bf870
4
+ data.tar.gz: b89fe9c4ed0bf5e0897307b695e7ff614df9b4a3cd8187e78038ff50a7bab22b
5
5
  SHA512:
6
- metadata.gz: cdb0c8db5b2b9ab99e6a1e8b04a9710a8c19913ebdcc528ed71e0b27f3dad7231887fc8415d85a5aea3bd91304f7682402530a9612ee77037ecf04b2ea050d80
7
- data.tar.gz: 4aed1036ef3f2d9937b8928ec0ccb6e6fc14651d8803cbaaddf52b3d0c3da3a7b744a4aa5db5a898440cef9edd45f77325009552fe3b7c5c9bbe9448b701e34f
6
+ metadata.gz: 33d83f27fdf2f22beabcea208bb6f19dce018c8b60b9f29a82771a4e7b2fbd5ad25abd9e42559c2967db6bec26d89b67464a3f59ff4fa806685549ca45d4d5d5
7
+ data.tar.gz: 2b0239e99adac86c1dd5d2324e9bd120ecb36a46b35b7411682c40c57a5e8767d2aff44e1ecbe32cdf613b064b5f14455bf786343ca3969f1fadb2b54bae3896
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  que-scheduler
2
2
  ================
3
3
 
4
- [![Gem Version](https://img.shields.io/gem/v/que-scheduler?color=green)](https://img.shields.io/gem/v/que-scheduler?color=green)
4
+ [![Gem Version](https://img.shields.io/gem/v/que-scheduler?color=green)](https://rubygems.org/gems/que-scheduler)
5
+ [![specs workflow](https://github.com/hlascelles/que-scheduler/actions/workflows/specs.yml/badge.svg)](https://github.com/hlascelles/que-scheduler/actions)
6
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
7
  [![Coverage Status](https://coveralls.io/repos/github/hlascelles/que-scheduler/badge.svg?branch=master)](https://coveralls.io/github/hlascelles/que-scheduler?branch=master)
6
8
  [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/710d2fc5202f95d76e8a/maintainability)](https://codeclimate.com/github/hlascelles/que-scheduler/maintainability)
7
9
 
@@ -10,6 +10,7 @@ module Que
10
10
  assert_db_migrated
11
11
  end
12
12
 
13
+ # rubocop:disable Metrics/MethodLength
13
14
  private def assert_db_migrated
14
15
  db_version = Que::Scheduler::Migrations.db_version
15
16
  return if db_version == Que::Scheduler::Migrations::MAX_VERSION
@@ -57,6 +58,7 @@ module Que
57
58
  synchronously. This will fail as que-scheduler needs the above tables to work.
58
59
  ERR
59
60
  end
61
+ # rubocop:enable Metrics/MethodLength
60
62
  end
61
63
  end
62
64
  end
@@ -96,18 +96,7 @@ module Que
96
96
  # be used when the job is worked.
97
97
  data = JSON.parse(job.to_json, symbolize_names: true)
98
98
 
99
- # ActiveJob scheduled_at is returned as a float, where we want a Time for consistency
100
- scheduled_at =
101
- begin
102
- scheduled_at_float = data[:scheduled_at]
103
- # rubocop:disable Style/EmptyElse
104
- if scheduled_at_float
105
- Que::Scheduler::TimeZone.time_zone.at(scheduled_at_float)
106
- else
107
- nil
108
- end
109
- # rubocop:enable Style/EmptyElse
110
- end
99
+ scheduled_at = self.class.extract_scheduled_at(data[:scheduled_at])
111
100
 
112
101
  # Rails didn't support queues for ActiveJob for a while
113
102
  used_queue = data[:queue_name] if ToEnqueue.active_job_version_supports_queues?
@@ -142,6 +131,22 @@ module Que
142
131
  job_class_set.perform_later(*args)
143
132
  end
144
133
  end
134
+
135
+ class << self
136
+ # ActiveJob scheduled_at is returned as a float, or a string post Rails 7.1,
137
+ # and we want a Time for consistency
138
+ def extract_scheduled_at(scheduled_at)
139
+ # rubocop:disable Style/EmptyElse
140
+ if scheduled_at.is_a?(Float)
141
+ Que::Scheduler::TimeZone.time_zone.at(scheduled_at)
142
+ elsif scheduled_at.is_a?(String)
143
+ Que::Scheduler::TimeZone.time_zone.parse(scheduled_at)
144
+ else
145
+ nil
146
+ end
147
+ # rubocop:enable Style/EmptyElse
148
+ end
149
+ end
145
150
  end
146
151
 
147
152
  # A value object returned after a job has been enqueued. This is necessary as Que (normal) and
@@ -1,5 +1,5 @@
1
1
  module Que
2
2
  module Scheduler
3
- VERSION = "5.0.0".freeze
3
+ VERSION = "5.1.1".freeze
4
4
  end
5
5
  end
data/lib/que-scheduler.rb CHANGED
@@ -1,3 +1 @@
1
- # rubocop:disable Naming/FileName
2
1
  require "que/scheduler"
3
- # rubocop:enable Naming/FileName
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: 5.0.0
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Lascelles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-10 00:00:00.000000000 Z
11
+ date: 2024-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1.1'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.1.8
36
+ version: 1.11.1
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '1.1'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.1.8
46
+ version: 1.11.1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hashie
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -436,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
436
436
  - !ruby/object:Gem::Version
437
437
  version: '0'
438
438
  requirements: []
439
- rubygems_version: 3.3.26
439
+ rubygems_version: 3.5.11
440
440
  signing_key:
441
441
  specification_version: 4
442
442
  summary: A cron scheduler for Que