batch_processor 0.2.5 → 0.2.6

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: b84438490d8878c15ac50c47cd794492ba09b242416925901ec9e0bfb0cf9d5c
4
- data.tar.gz: 718bb854458479e297dae9b902d76a2e03bba68cbf53054ff2726c894e346564
3
+ metadata.gz: e67aa3da97a88da1106578b16d93065d9cbcb8c1ad7045e4d1ca685a201bbb02
4
+ data.tar.gz: 52017c9ea65ebcec0092d3fd6740aa3aa13df2d89561470a58f28088fa182177
5
5
  SHA512:
6
- metadata.gz: 5822bc83e28b613c5e211606d75f015fedb66a5d0cce955f815a866a73cc4f460d7ebdb59b98dbf84573979619cf4f995c4cbab4b2ec7c4317f42c16852a61dc
7
- data.tar.gz: e7223742d5e6dd841a6ae633c7a91f5a94ee597d6caeafd3df19aec8415897f192ef5da8da16e68fd7de63c57727dadbe86ae462097346e2b691e1ca1bb60ca9
6
+ metadata.gz: 725655af2c8944fcbcf837a2cf80e01992310c5c37352bd10da0ef6efdc60192ddc1224437fd6e3008be48383673d101a6d43680235c4b41d4aa2ed2d7d02441
7
+ data.tar.gz: ce203c992d02fa528a5bab0971a5e38d29390de28312aba53ba0173681f5dbe5e3f5c45da95bbbe351e5c0ba34144cd5c7cab077fff8ab60fec9ab4417a67110
@@ -3,7 +3,7 @@
3
3
  # A batch can only be processed by a batchable job.
4
4
  module BatchProcessor
5
5
  class BatchJob < ActiveJob::Base
6
- attr_accessor :batch_id, :tracked_batch_running
6
+ attr_accessor :batch_id, :tracked_batch_running, :tracked_batch_failure
7
7
 
8
8
  include Technologic
9
9
 
@@ -27,10 +27,15 @@ module BatchProcessor
27
27
 
28
28
  after_perform(if: :batch_job?) { batch.job_success }
29
29
 
30
+ # Some combination of Sidekiq + ActiveJob + Postgres + Deadlocks = this getting called twice for the same instance.
31
+ # It is unclear WHY that situation happens, but during the second execution, the instance no longer has it's job_id
32
+ # but somehow still has a batch ID. It seems regardless, an internal semaphore seems to prevent miscounting in that
33
+ # situation. I'd love to know what the root cause is behind it, but async debugging is time consuming and hard. :(
30
34
  def rescue_with_handler(exception)
31
35
  batch.job_canceled and return exception if exception.is_a?(BatchAbortedError)
32
36
 
33
- batch_job_failure(exception) if batch_job?
37
+ batch_job_failure(exception) if batch_job? && !tracked_batch_failure
38
+ self.tracked_batch_failure = true
34
39
 
35
40
  super
36
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BatchProcessor
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batch_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Garside
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob