que-scheduler 5.0.0 → 5.1.0

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: ba72652aebf9c4fb8c0f07702d03fdb2a119c54ed4b900c309acdf5a7200bdc4
4
+ data.tar.gz: a83083a1c0fb05be711857c255bd18c1870f707522d070363def5b2de22271b3
5
5
  SHA512:
6
- metadata.gz: cdb0c8db5b2b9ab99e6a1e8b04a9710a8c19913ebdcc528ed71e0b27f3dad7231887fc8415d85a5aea3bd91304f7682402530a9612ee77037ecf04b2ea050d80
7
- data.tar.gz: 4aed1036ef3f2d9937b8928ec0ccb6e6fc14651d8803cbaaddf52b3d0c3da3a7b744a4aa5db5a898440cef9edd45f77325009552fe3b7c5c9bbe9448b701e34f
6
+ metadata.gz: caf4f8b82b646f78cf133d8bc8bf78eed5609517a29275a0c27558c05732435393b51479a825b1004c6d980cd3365657b6ff7a7e7393f61497579ad4dbaf769c
7
+ data.tar.gz: 49eb2acebbe74606970f06d2df9cdff5dbf482233382f9237c459f3ccc5e61d6cee065fd6060974e04f748a6c72391db3369ac966aa5e60a1f3a621bdd6d9cc8
@@ -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.0".freeze
4
4
  end
5
5
  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: 5.0.0
4
+ version: 5.1.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: 2024-03-10 00:00:00.000000000 Z
11
+ date: 2024-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport