tapsoob 0.7.14-java → 0.7.15-java
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 +4 -4
- data/lib/tapsoob/cli/data_stream.rb +6 -11
- data/lib/tapsoob/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 603125d71664da91f5e3c51a3cf5ebda246ab72d337a8728a0bab46d4f2dbdcf
|
|
4
|
+
data.tar.gz: f564c0d968d9cc607ecff02959b39d1feb15797c967f87caa1b67a4d797328bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da03d8a5c49d707e9e75921741aeb47d78316d72900a8573b98435cc8e2a9c635bfdfd5260a4255946817d5bb05be1e2effa3132feb691199f639241a4900058
|
|
7
|
+
data.tar.gz: b81389433b8ccc877cdfc92d46104344fc200b2cab305f77e5b14a68b1df88fe5c62b0dfc9a936036aeb59afda4386c39f9d2dc811b529603ee12e39896195b6
|
|
@@ -58,26 +58,21 @@ module Tapsoob
|
|
|
58
58
|
table = JSON.parse(line, symbolize_names: true)
|
|
59
59
|
table_name = table[:table_name]
|
|
60
60
|
|
|
61
|
+
conn = Sequel.connect(database_url)
|
|
61
62
|
begin
|
|
62
|
-
|
|
63
|
-
if opts[:purge]
|
|
64
|
-
db(database_url, opts)[table_name.to_sym].truncate
|
|
65
|
-
end
|
|
63
|
+
conn[table_name.to_sym].truncate if opts[:purge]
|
|
66
64
|
|
|
67
|
-
stream = Tapsoob::DataStream::Base.factory(
|
|
65
|
+
stream = Tapsoob::DataStream::Base.factory(conn, {
|
|
68
66
|
table_name: table_name,
|
|
69
67
|
chunksize: opts[:default_chunksize]
|
|
70
68
|
}, { :"discard-identity" => opts[:"discard-identity"] || false, :purge => opts[:purge] || false, :debug => opts[:debug] })
|
|
71
69
|
|
|
72
70
|
stream.import_rows(table)
|
|
73
|
-
rescue Sequel::DatabaseDisconnectError, Sequel::DatabaseConnectionError => e
|
|
74
|
-
# Connection dropped (e.g. MySQL wait_timeout); reconnect and retry once
|
|
75
|
-
STDERR.puts "Connection lost for #{table_name}, reconnecting... (#{e.message.lines.first.chomp})"
|
|
76
|
-
@db = nil
|
|
77
|
-
retry
|
|
78
71
|
rescue Exception => e
|
|
79
72
|
Tapsoob.log.debug e.message
|
|
80
|
-
STDERR.puts "Error loading data in #{table_name} : #{e.message}
|
|
73
|
+
STDERR.puts "Error loading data in #{table_name} : #{e.message}"
|
|
74
|
+
ensure
|
|
75
|
+
conn.disconnect
|
|
81
76
|
end
|
|
82
77
|
end
|
|
83
78
|
end
|
data/lib/tapsoob/version.rb
CHANGED