batches_task_processor 0.3.4 → 0.3.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69f248153b65e49d24ebbebaa064cb3f5e03aec503cb2d2b9add636c96e8aad4
|
4
|
+
data.tar.gz: d020b38e7e8fea12d7a7df841ca976881ab86b7dee326f3befd4ccc94d205033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bfdfae31beed3d6bb7ea8c3004f842bd5936a94d9f188ebfaeb573c44f38207aeef2ea343bc9db848ce66c50e1ff27d9da4c5a261f98b783c95551e7a3f7059
|
7
|
+
data.tar.gz: 4219b4010280239086ee4a9dabe50876a495f599f2d4450227cd8c8dac105ae9e798aa7e2348838b52b8e9c7f78a61aded822e334f9674cca5c1edb92cd8784a
|
@@ -41,6 +41,10 @@ module BatchesTaskProcessor
|
|
41
41
|
Rails.logger.info "Process status: #{items.count}/#{data.count}"
|
42
42
|
end
|
43
43
|
|
44
|
+
def retry_failures
|
45
|
+
start!
|
46
|
+
end
|
47
|
+
|
44
48
|
def export
|
45
49
|
filename = (key || 'batches_task_processor_result').try(:parameterize)
|
46
50
|
path = Rails.root.join("tmp/#{filename}.csv")
|
@@ -55,7 +55,7 @@ module BatchesTaskProcessor
|
|
55
55
|
(items.try(:find_each) || items.each).with_index(1) do |item, index|
|
56
56
|
key = item.try(:id) || item
|
57
57
|
break log('Process cancelled') if process_cancelled?
|
58
|
-
next
|
58
|
+
next if already_processed?(key)
|
59
59
|
|
60
60
|
start_process_item(item, job, key, index)
|
61
61
|
end
|
@@ -72,14 +72,14 @@ module BatchesTaskProcessor
|
|
72
72
|
def start_process_item(item, job, key, index)
|
73
73
|
log "Processing key: #{key}, job: #{job}, counter: #{index}/#{task_model.qty_items_job}"
|
74
74
|
result = process_item(item)
|
75
|
-
task_model.items.
|
75
|
+
task_model.items.where(key: key).first_or_initialize.update!(result: result, error_details: nil)
|
76
76
|
rescue => e
|
77
|
-
task_model.items.
|
77
|
+
task_model.items.where(key: key).first_or_initialize.update!(result: nil, error_details: e.message)
|
78
78
|
log "Process failed #{job}/#{key}: #{e.message}"
|
79
79
|
end
|
80
80
|
|
81
81
|
def already_processed?(key)
|
82
|
-
task_model.items.where(key: key).exists?
|
82
|
+
task_model.items.where(key: key, error_details: nil).exists?
|
83
83
|
end
|
84
84
|
|
85
85
|
def process_cancelled?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: batches_task_processor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Peredo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|