sidekiq-iteration 0.4.0 → 0.4.1

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: ea1fc3e6f5faff037ecfade45cc58bd2035385cafb888ef67ce253d12295aee8
4
- data.tar.gz: a4bf097d4a1a8750f4d3e2ac9ce4f01191b5e7313635fed3d958b89647639c9a
3
+ metadata.gz: b1d594bb1cfeb59bac823dffb9ec0d5b85063b8af421e070045a1ba280d03932
4
+ data.tar.gz: ecd9989d7f033b1b3d760b42854488ba2a50c3b654d95cd623b033215b1ca43d
5
5
  SHA512:
6
- metadata.gz: 415f27277011c3721853ae64c1c78c566a3bfe2c690ebaeb8e9e05bb10b4f3faac00cda0f6f95ef9fd980993695edc6621085833c7901bb09b14ff6027467622
7
- data.tar.gz: 68568c8205c0370a3d1765e5bd6431655d1a3d5fd0ff07ee65fc6e8bf1dd0447fba1a62978c45fea3850029a9046f4cbe7768bce885f5bcb4d9c8e322a539ab6
6
+ metadata.gz: c8c866af7e7ec1ce3fc701c6695ea6c0ad8aec90c8ed94790ed274ab7a909a8e6b9dff51ec9c766af7f82c29f507bdb4f692a0446bb77e3ba4c78ea26a5f47be
7
+ data.tar.gz: 65a93c00c0e51a69f2339d8c5aba717e18c6530a865c66aa23eed3dbf5ecdf67513ef659e020a24b01be23dc51c5bc9716acf3a3671f78a73107281c06429f9f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## 0.4.1 (2026-02-26)
4
+
5
+ - Fix processing the same item twice for interrupted jobs
6
+
3
7
  ## 0.4.0 (2024-05-10)
4
8
 
5
9
  - Support ordering using multiple directions for ActiveRecord enumerators
data/README.md CHANGED
@@ -32,7 +32,7 @@ Software that is designed for high availability [must be resilient](https://12fa
32
32
 
33
33
  ## Requirements
34
34
 
35
- - Ruby 2.7+ (if you need support for older ruby, [open an issue](https://github.com/fatkodima/sidekiq-iteration/issues/new))
35
+ - Ruby 2.7+
36
36
  - Sidekiq 6+
37
37
 
38
38
  ## Installation
@@ -78,7 +78,7 @@ module SidekiqIteration
78
78
  Enumerator.new(-> { records_size }) do |yielder|
79
79
  while (batch = next_batch(load: true))
80
80
  increment_iteration
81
- yielder.yield(batch, cursor_value(batch.last))
81
+ yielder.yield(batch, cursor_value(batch.first))
82
82
  end
83
83
  end
84
84
  end
@@ -183,11 +183,7 @@ module SidekiqIteration
183
183
 
184
184
  enumerator.each do |object_from_enumerator, index|
185
185
  found_record = true
186
- around_iteration do
187
- each_iteration(object_from_enumerator, *arguments)
188
- end
189
186
  @cursor_position = index
190
- @current_run_iterations += 1
191
187
 
192
188
  throttle_condition = find_throttle_condition
193
189
  if throttle_condition
@@ -195,6 +191,11 @@ module SidekiqIteration
195
191
  @needs_reenqueue = true
196
192
  return false
197
193
  end
194
+
195
+ around_iteration do
196
+ each_iteration(object_from_enumerator, *arguments)
197
+ end
198
+ @current_run_iterations += 1
198
199
  end
199
200
 
200
201
  unless found_record
@@ -236,9 +237,9 @@ module SidekiqIteration
236
237
  raise ArgumentError, <<~MSG
237
238
  #build_enumerator is expected to return Enumerator object, but returned #{enum.class}.
238
239
  Example:
239
- def build_enumerator(params, cursor:)
240
- enumerator_builder.active_record_on_records(
241
- Shop.find(params[:shop_id]).products,
240
+ def build_enumerator(params, cursor:)
241
+ active_record_records_enumerator(
242
+ Shop.find(params["shop_id"]).products,
242
243
  cursor: cursor
243
244
  )
244
245
  end
@@ -33,6 +33,9 @@ module SidekiqIteration
33
33
  else
34
34
  iterate(current_items + [item], current_cursor + [cursor_value], index + 1, &block)
35
35
  end
36
+
37
+ # Nullify downstream enums cursors on each iteration.
38
+ @cursor.fill(nil, index + 1)
36
39
  end
37
40
  end
38
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqIteration
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-iteration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fatkodima
8
8
  - Shopify
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-05-10 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: sidekiq
@@ -25,7 +24,6 @@ dependencies:
25
24
  - - ">="
26
25
  - !ruby/object:Gem::Version
27
26
  version: '6.0'
28
- description:
29
27
  email:
30
28
  - fatkodima123@gmail.com
31
29
  executables: []
@@ -57,7 +55,6 @@ metadata:
57
55
  homepage_uri: https://github.com/fatkodima/sidekiq-iteration
58
56
  source_code_uri: https://github.com/fatkodima/sidekiq-iteration
59
57
  changelog_uri: https://github.com/fatkodima/sidekiq-iteration/blob/master/CHANGELOG.md
60
- post_install_message:
61
58
  rdoc_options: []
62
59
  require_paths:
63
60
  - lib
@@ -72,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
69
  - !ruby/object:Gem::Version
73
70
  version: '0'
74
71
  requirements: []
75
- rubygems_version: 3.4.19
76
- signing_key:
72
+ rubygems_version: 4.0.3
77
73
  specification_version: 4
78
74
  summary: Makes your long-running sidekiq jobs interruptible and resumable.
79
75
  test_files: []