sidekiq-amigo 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/amigo/audit_logger.rb +1 -1
- data/lib/amigo/deprecated_jobs.rb +1 -0
- data/lib/amigo/job.rb +2 -2
- data/lib/amigo/router.rb +3 -1
- data/lib/amigo/scheduled_job.rb +0 -2
- data/lib/amigo/spec_helpers.rb +2 -0
- data/lib/amigo/version.rb +1 -1
- data/lib/amigo.rb +24 -19
- 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: 8980dca10a4706347222badd39dbd267466d6b5add00eaba00e25181467b4964
|
4
|
+
data.tar.gz: 48f7d54c1d104fdafbcc1eb27367084d89c6b77dbf71c1256f30faf88f3b0a10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5660f11c1f9f76603e61fdc2f3dbbd16031c32871dce14f587990a5ab076e4573311483d322d58bea4cef392764ae4a6bf663945a23356782c04a8b805075417
|
7
|
+
data.tar.gz: fd2303da8f7c9c9cd0ea279b4ab2913a1e4ae4c817bad60c2ef9c7541213d7783b8843843a3112b68dab5a1c99d107fc870b86db29bd8c6598b0f095cf6e1b37
|
data/lib/amigo/audit_logger.rb
CHANGED
data/lib/amigo/job.rb
CHANGED
data/lib/amigo/router.rb
CHANGED
data/lib/amigo/scheduled_job.rb
CHANGED
data/lib/amigo/spec_helpers.rb
CHANGED
data/lib/amigo/version.rb
CHANGED
data/lib/amigo.rb
CHANGED
@@ -98,10 +98,9 @@ require "sidekiq-cron"
|
|
98
98
|
# Splay defaults to 30s; you may wish to always provide splay, whatever you think for your job.
|
99
99
|
#
|
100
100
|
class Amigo
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
require "amigo/router"
|
101
|
+
class Error < StandardError; end
|
102
|
+
|
103
|
+
class StartSchedulerFailed < Error; end
|
105
104
|
|
106
105
|
class << self
|
107
106
|
attr_accessor :structured_logging
|
@@ -180,6 +179,8 @@ class Amigo
|
|
180
179
|
# Install Amigo so that every publish will be sent to the AuditLogger job
|
181
180
|
# and will invoke the relevant jobs in registered_jobs via the Router job.
|
182
181
|
def install_amigo_jobs
|
182
|
+
require "amigo/audit_logger"
|
183
|
+
require "amigo/router"
|
183
184
|
return self.register_subscriber do |ev|
|
184
185
|
self._subscriber(ev)
|
185
186
|
end
|
@@ -190,21 +191,25 @@ class Amigo
|
|
190
191
|
Amigo::AuditLogger.perform_async(event_json)
|
191
192
|
Amigo::Router.perform_async(event_json)
|
192
193
|
end
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
#
|
199
|
-
#
|
200
|
-
#
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
194
|
+
|
195
|
+
def register_job(job)
|
196
|
+
self.registered_jobs << job
|
197
|
+
end
|
198
|
+
|
199
|
+
# Start the scheduler.
|
200
|
+
# This should generally be run in the Sidekiq worker process,
|
201
|
+
# not a webserver process.
|
202
|
+
def start_scheduler(load_from_hash=Sidekiq::Cron::Job.method(:load_from_hash))
|
203
|
+
hash = self.registered_scheduled_jobs.each_with_object({}) do |job, memo|
|
204
|
+
self.log(nil, :info, "scheduling_job_cron", {job_name: job.name, job_cron: job.cron_expr})
|
205
|
+
memo[job.name] = {
|
206
|
+
"class" => job.name,
|
207
|
+
"cron" => job.cron_expr,
|
208
|
+
}
|
209
|
+
end
|
210
|
+
load_errs = load_from_hash.call(hash) || {}
|
211
|
+
raise StartSchedulerFailed, "Errors loading sidekiq-cron jobs: %p" % [load_errs] unless load_errs.empty?
|
212
|
+
end
|
208
213
|
end
|
209
214
|
|
210
215
|
class Event
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-amigo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lithic Technology
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|