tapsoob 0.7.14 → 0.7.16

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: c2dac10255fe54eed67a615eceac52ef21dc58e5652aacd754f334c5b678a2fa
4
- data.tar.gz: a51cb604a0597e99828ae0f3015b54c6b8816baea04237946cb563e4b81d63ca
3
+ metadata.gz: fa06cf4e6f87d711d4f15d9a5c43e280e40a8f847686238ddb43f75cce3d396e
4
+ data.tar.gz: 1c3433acc80cd43dd21846be0a67e33f2966cf7be07f6b9336702a7867c6f7b0
5
5
  SHA512:
6
- metadata.gz: b93c99785aa3b9290142e5245184acb4f8a6721244536127391f94f592b3015f27ea236ddd5282254ee073636313d06b5371648f223d9a4d09c9ca3cb8fec7ec
7
- data.tar.gz: 1705b7c0d5cbeb47aef0b3724d560251d72aab4621ea82ec11a8a7cd6ec4770d592af18f8ad6e0b98149055168e5f3adc939a478cd532444846895ec7f71848a
6
+ metadata.gz: e989dc986ec8ec6e37b18cdbe8e32fc6b6de5d9acbb17ccd9382f0fbb4aeb791d5e92535aeeb43592d468b390e6a5d32160227ba130d686b3741b021215e4e73
7
+ data.tar.gz: 1d663ab0db9ac3468dcefa556dd772984fd49ae1af121ed4530fe464c4d3e98d29db61e4cedde925cb2046e19871ec7ed3dfcf71aaf7d51b70f3ee65ccb45800
@@ -58,26 +58,28 @@ 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
- # Truncate table if purge option is enabled
63
- if opts[:purge]
64
- db(database_url, opts)[table_name.to_sym].truncate
63
+ if conn.uri =~ /mysql/i
64
+ conn.run("SET SESSION wait_timeout=28800")
65
+ conn.run("SET SESSION interactive_timeout=28800")
66
+ conn.run("SET SESSION net_read_timeout=3600")
67
+ conn.run("SET SESSION net_write_timeout=3600")
65
68
  end
66
69
 
67
- stream = Tapsoob::DataStream::Base.factory(db(database_url, opts), {
70
+ conn[table_name.to_sym].truncate if opts[:purge]
71
+
72
+ stream = Tapsoob::DataStream::Base.factory(conn, {
68
73
  table_name: table_name,
69
74
  chunksize: opts[:default_chunksize]
70
75
  }, { :"discard-identity" => opts[:"discard-identity"] || false, :purge => opts[:purge] || false, :debug => opts[:debug] })
71
76
 
72
77
  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
78
  rescue Exception => e
79
79
  Tapsoob.log.debug e.message
80
- STDERR.puts "Error loading data in #{table_name} : #{e.message}\n#{e.backtrace.first(5).join("\n")}"
80
+ STDERR.puts "Error loading data in #{table_name} : #{e.message}"
81
+ ensure
82
+ conn.disconnect
81
83
  end
82
84
  end
83
85
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.7.14".freeze
3
+ VERSION = "0.7.16".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapsoob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.14
4
+ version: 0.7.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger