mysql_import 0.5.1 → 0.5.2

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
  SHA1:
3
- metadata.gz: 6c08058a7b97339c5b1430305cc1b018115a2dc2
4
- data.tar.gz: da048c87f35ec063ebd1b878a559eb729b0736f0
3
+ metadata.gz: 29c2cc452ed64d1ef3c41c20c1198437fa9e6d2c
4
+ data.tar.gz: 399d19ca719fc480d9031b2dbc9a55ce7c9d7549
5
5
  SHA512:
6
- metadata.gz: 9aa69b3d325586ee4f373e93739e037a89c994d12b8ba1235702df1feee86a90a997098f0ba6989610eb62a624bb413822e55a279a3d1a9374883706cb230273
7
- data.tar.gz: daee1ab1ac5eb517319155e8f9e16df785cf53fd6ef61aeef44a8808b0dde29ad069ba2023ce3ff41010b07904dbeabfee663d91b2102118f35a056371e4973e
6
+ metadata.gz: 7e97ae3ea5baf48ab3507fe0bd72affaf2cb4de093a30cf152d9332de2fb81654e38e6a1b2a830672f169717bfe525982b0c6e6b190d55466134b9d1fec2965f
7
+ data.tar.gz: db0283a0db2d2d9995bde1f923be20c516725598c627cbe617322d563f8702be29918446f3ff6c6542b452ed2f1b7d355ff7bdcc0f3690783b3f77508b4354f2
data/lib/mysql_import.rb CHANGED
@@ -52,7 +52,10 @@ class MysqlImport
52
52
  lock = opts.fetch(:lock, @lock)
53
53
 
54
54
  begin
55
- write_lock(cli, table) if lock
55
+ if lock
56
+ write_lock(cli, table)
57
+ lt = Time.now
58
+ end
56
59
 
57
60
  run_action(opts[:before], cli)
58
61
 
@@ -63,8 +66,12 @@ class MysqlImport
63
66
  rescue Break
64
67
  @result.skipped.push(table) unless imported
65
68
  ensure
66
- unlock(cli) if lock
67
- @result.imported.push([table, (Time.now - t)]) if imported
69
+ res = [table, (Time.now - t)]
70
+ if lock
71
+ res.push(Time.now - lt)
72
+ unlock(cli)
73
+ end
74
+ @result.imported.push(res) if imported
68
75
  end
69
76
  end
70
77
 
@@ -30,7 +30,12 @@ class MysqlImport
30
30
  ensure
31
31
  @logger.info('Imported tables:')
32
32
  if @result.imported.size > 0
33
- @result.imported.sort.each {|t| @logger.info(" #{t[0]} (#{t[1]} sec)") }
33
+ @result.imported.sort.each do |t|
34
+ msg = " #{t[0]} (exec:#{format('%.3fs', t[1])}"
35
+ msg << " lock:#{format('%.3fs', t[2])}" if t[2]
36
+ msg << ')'
37
+ @logger.info(msg)
38
+ end
34
39
  else
35
40
  @logger.info(' nothing...')
36
41
  end
@@ -1,3 +1,3 @@
1
1
  class MysqlImport
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nalabjp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-23 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: load_data_infile2