chained_job 0.3.0 → 0.4.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: b302104a73850add4edc180a181961885c7c5a5c8bc520fc26b3dfa1a82c6d39
4
- data.tar.gz: 25c67ef1d56381c0704ef70e182937412c120ff995b01ef6036e2fd840f5ab29
3
+ metadata.gz: 2754a3795b49b29119699d834fa7fd30a3618c5c9b9e4e13c0d806f1e681b1c7
4
+ data.tar.gz: cd5a4e01156701bb5c232a67d1731bc592b4caafd3bc1c09ec11e23acb10efd3
5
5
  SHA512:
6
- metadata.gz: 46c772e243c573a1cb4dd16b21d2cd34127665e174eab7c90946dd3065941f509b35a05b5c6fb498f634f5b03d4b926ccd3747626f66fbe2591f53423ace47a3
7
- data.tar.gz: fc1881df18aa578066ca959c22e21617dc089b0a7615fc4c340c501bb06a35e52e99f587084b50729e6ab3c62b7aafb6bec7e60de4a2663968423db88b267fc9
6
+ metadata.gz: 012b685a5f4b0a457d70125e4d49f1fba4634650ec8b684d34cffafe35b4327807de56670ec6026ec87a773fdb641477452474205629104be846d6757ff9444c
7
+ data.tar.gz: 122694c013a12d28b1c781b8b593bcf7e1dd40209642d8c3879a69821792c0258dadaf0f7b3b1dd06990ae802489256699a42abbb8eed2cadbfe2e3efc0099dc
@@ -13,6 +13,7 @@ module ChainedJob
13
13
  :around_start_chains,
14
14
  :around_chain_process,
15
15
  :around_array_of_job_arguments,
16
+ :after_worker_finished,
16
17
  :debug,
17
18
  :logger,
18
19
  :redis,
@@ -28,6 +29,7 @@ module ChainedJob
28
29
  self.around_start_chains = ->(_options, &block) { block.call }
29
30
  self.around_chain_process = ->(_options, &block) { block.call }
30
31
  self.around_array_of_job_arguments = ->(_options, &block) { block.call }
32
+ self.after_worker_finished = ->(_options) {}
31
33
 
32
34
  self.debug = true
33
35
  end
@@ -18,7 +18,7 @@ module ChainedJob
18
18
 
19
19
  def run
20
20
  with_hooks do
21
- return log_finished_worker unless argument
21
+ return finished_worker unless argument
22
22
 
23
23
  job_instance.process(argument)
24
24
  job_instance.class.perform_later(worker_id, job_tag)
@@ -32,7 +32,13 @@ module ChainedJob
32
32
  end
33
33
 
34
34
  def options
35
- { job_class: job_instance.class, worker_id: worker_id }
35
+ @options ||= { job_class: job_instance.class, worker_id: worker_id }
36
+ end
37
+
38
+ def finished_worker
39
+ log_finished_worker
40
+
41
+ ChainedJob.config.after_worker_finished&.call(options)
36
42
  end
37
43
 
38
44
  def log_finished_worker
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChainedJob
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chained_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mantas Kūjalis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-19 00:00:00.000000000 Z
12
+ date: 2020-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler