ntq_excelsior_engine 1.0.2 → 1.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 149fb970b09822b3700a0feea155925cc053758cad0293d60511cefd33d3b774
|
4
|
+
data.tar.gz: 871c628686c6ead3c67ffd5a86d3c0596e87d56796671c272f43c85ee4a4b45f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f6391929e87d982d1c10b71335d75600b84851bcc2823a5e4c8fd63b239cfb7054d5a876b93dc277b832d0b8a1fb7ddd2115d946e37502b9e181b5b30be26e
|
7
|
+
data.tar.gz: 165b172c9ad7d47a1aff11a0a2d66da3ea161462f3fc2de5c142bc9759a512697d89f64dae316543877ff9a86c668834ad06c1a0a06559831b21ac30809adfcd
|
@@ -1,14 +1,13 @@
|
|
1
1
|
module NtqExcelsiorEngine
|
2
2
|
class Imports::LoadLines
|
3
3
|
include Interactor
|
4
|
-
|
4
|
+
|
5
5
|
around do |interactor|
|
6
|
-
if context.actions && context.actions.include?(
|
7
|
-
interactor.call
|
8
|
-
end
|
6
|
+
interactor.call if context.actions && context.actions.include?('load') && context.import && context.importer
|
9
7
|
end
|
10
|
-
|
8
|
+
|
11
9
|
def call
|
10
|
+
sleep NtqExcelsiorEngine.delay_before_import if NtqExcelsiorEngine.delay_before_import > 0
|
12
11
|
import = context.import
|
13
12
|
importer = context.importer.new
|
14
13
|
begin
|
@@ -27,11 +26,12 @@ module NtqExcelsiorEngine
|
|
27
26
|
import.temp_file.unlink
|
28
27
|
rescue Roo::HeaderRowNotFoundError => e
|
29
28
|
import.update(state: 'error', error_message: 'header_not_found', backtrace: e.message)
|
30
|
-
rescue => e
|
29
|
+
rescue StandardError => e
|
31
30
|
raise e if NtqExcelsiorEngine.debug
|
31
|
+
|
32
32
|
Appsignal.send_error(e)
|
33
33
|
import.update(state: 'error', error_message: e.message, backtrace: e.backtrace.join('\n'))
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
end
|
37
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module NtqExcelsiorEngine
|
2
2
|
class Import < ::ApplicationRecord
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
self.table_name = 'excelsior_imports'
|
4
|
+
|
6
5
|
attr_accessor :async
|
7
6
|
|
8
|
-
enum state: { pending: 'pending', buffering: 'buffering', buffered: 'buffered', imported: 'imported',
|
7
|
+
enum state: { pending: 'pending', buffering: 'buffering', buffered: 'buffered', imported: 'imported',
|
8
|
+
error: 'error', importing: 'importing', checking: 'checking', checked: 'checked' }
|
9
9
|
|
10
10
|
serialize :options, Hash
|
11
11
|
serialize :headers, Hash
|
@@ -21,7 +21,6 @@ module NtqExcelsiorEngine
|
|
21
21
|
validates :import_type, presence: true
|
22
22
|
validates :import_type, inclusion: { in: NtqExcelsiorEngine.importers.keys.map(&:to_s) }, on: :create
|
23
23
|
|
24
|
-
|
25
24
|
def temp_file
|
26
25
|
return @tmp if @tmp
|
27
26
|
|
@@ -37,10 +36,9 @@ module NtqExcelsiorEngine
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def process_import!(actions: NtqExcelsiorEngine.actions_on_create.map(&:to_s))
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
39
|
+
return unless async || (async.nil? && NtqExcelsiorEngine.async)
|
40
|
+
|
41
|
+
job_id = NtqExcelsiorEngine::ProcessImportJob.perform_async(id, actions.join(','))
|
44
42
|
end
|
45
43
|
end
|
46
44
|
end
|
data/lib/ntq_excelsior_engine.rb
CHANGED