job-iteration 1.3.2 → 1.3.3

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: 63917aaf8f527e78cd47f62111dbda8473c90907eeaa8827ed23aaba77f494a0
4
- data.tar.gz: 4fa0d5ce8eb5c1e7cdc2712daae6ddf689cfd1ae7cc3f840abe7b45628ee7735
3
+ metadata.gz: d715ff6962fc9ff1081d5db93be694b0f0ed3e9fc2935b0d9f252971ea8a40d0
4
+ data.tar.gz: 60571b6b588816ad637a0eaaee238adb423c230102d4a73745e0fcc3b9e41b17
5
5
  SHA512:
6
- metadata.gz: ae0a1330b24adfa55c045cd079806c350e151ee7c12555c9397143919c8f77fdc3023cb23330fc529af3771da31379991830513ce0459e1ff5ff21614e0518d0
7
- data.tar.gz: 0733a5377c27ff39acd118f3e719e52bd82a7a63d7f03508b61c6ced900baef9bc0e05bdc5b43d87d6e36f05339bf9a84c1ffd5c1ce70c06cb172ee3c3905240
6
+ metadata.gz: 587952d2f628c6d43c982ee8a4fe85d409d4d39044b34aa436bf97a2dd2679d92bfcb098bb2b35380b90297359dbefddc805a188501bd464665e8199a21f673e
7
+ data.tar.gz: dc172c2fa8172ee47d2af5ed7d47513b8e1131121f6b4f8deebf534a1c7f7e38e8b01f421bf3cc1e419aec9d1c5469020e690757be1e87c35e6d6dc0db8a437c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ### Master (unreleased)
2
2
 
3
+ ## v.1.3.3 (Nov 17, 2021)
4
+ - [153](https://github.com/Shopify/job-iteration/pull/153) - Re-enqueue jobs only after shutdown hooks have run
5
+
3
6
  ## v1.3.2 (Nov 12, 2021)
4
7
  - [148](https://github.com/Shopify/job-iteration/pull/148) - Revert "Do not evaluate enumerator when throttled", due to backwards incompatibility.
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- job-iteration (1.3.2)
4
+ job-iteration (1.3.3)
5
5
  activejob (>= 5.2)
6
6
 
7
7
  GEM
@@ -33,7 +33,7 @@ GEM
33
33
  database_cleaner-core (2.0.1)
34
34
  globalid (0.5.2)
35
35
  activesupport (>= 5.0)
36
- i18n (1.8.10)
36
+ i18n (1.8.11)
37
37
  concurrent-ruby (~> 1.0)
38
38
  method_source (1.0.0)
39
39
  minitest (5.14.4)
@@ -58,7 +58,7 @@ GEM
58
58
  redis-namespace (1.8.1)
59
59
  redis (>= 3.0.4)
60
60
  regexp_parser (2.1.1)
61
- resque (2.1.0)
61
+ resque (2.2.0)
62
62
  mono_logger (~> 1.0)
63
63
  multi_json (~> 1.0)
64
64
  redis-namespace (~> 1.6)
@@ -80,7 +80,7 @@ GEM
80
80
  rubocop (~> 1.22)
81
81
  ruby-progressbar (1.11.0)
82
82
  ruby2_keywords (0.0.5)
83
- sidekiq (6.2.2)
83
+ sidekiq (6.3.1)
84
84
  connection_pool (>= 2.2.2)
85
85
  rack (~> 2.0)
86
86
  redis (>= 4.2.0)
@@ -40,7 +40,7 @@ module JobIteration
40
40
  end
41
41
 
42
42
  def size
43
- (@base_relation.count + @batch_size - 1) / @batch_size # ceiling division
43
+ (@base_relation.count(:all) + @batch_size - 1) / @batch_size # ceiling division
44
44
  end
45
45
 
46
46
  private
@@ -34,7 +34,7 @@ module JobIteration
34
34
  end
35
35
 
36
36
  def size
37
- @relation.count
37
+ @relation.count(:all)
38
38
  end
39
39
 
40
40
  private
@@ -68,6 +68,7 @@ module JobIteration
68
68
 
69
69
  def initialize(*arguments)
70
70
  super
71
+ @needs_reenqueue = false
71
72
  self.times_interrupted = 0
72
73
  self.total_time = 0.0
73
74
  assert_implements_methods!
@@ -132,7 +133,9 @@ module JobIteration
132
133
 
133
134
  run_callbacks(:shutdown)
134
135
 
135
- if run_complete_callbacks?(completed)
136
+ if @needs_reenqueue
137
+ reenqueue_iteration_job
138
+ elsif run_complete_callbacks?(completed)
136
139
  run_callbacks(:complete)
137
140
  output_interrupt_summary
138
141
  end
@@ -141,6 +144,8 @@ module JobIteration
141
144
  def iterate_with_enumerator(enumerator, arguments)
142
145
  arguments = arguments.dup.freeze
143
146
  found_record = false
147
+ @needs_reenqueue = false
148
+
144
149
  enumerator.each do |object_from_enumerator, index|
145
150
  # Deferred until 2.0.0
146
151
  # assert_valid_cursor!(index)
@@ -153,7 +158,7 @@ module JobIteration
153
158
 
154
159
  next unless job_should_exit?
155
160
  self.executions -= 1 if executions > 1
156
- reenqueue_iteration_job
161
+ @needs_reenqueue = true
157
162
  return false
158
163
  end
159
164
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JobIteration
4
- VERSION = "1.3.2"
4
+ VERSION = "1.3.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job-iteration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-13 00:00:00.000000000 Z
11
+ date: 2021-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord