zold 0.14.30 → 0.14.31

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
  SHA1:
3
- metadata.gz: 6cc2c9a06ec680bec280cb382f348e26218bb5eb
4
- data.tar.gz: ea589142c06d8bfa303c92ac2c4d388d507aeb8f
3
+ metadata.gz: '069e29f108987ab9bdc7277b07493fd5b19ca10d'
4
+ data.tar.gz: f4bc525e8f801da0f81bc17042e2abadd022d65c
5
5
  SHA512:
6
- metadata.gz: 9c80a2d92a54afe3fb54ade3df2026c8371d3c419b03cc319d60a096e19cbf2070ec633d578a3210a4c37d4858ff286dc6a65bd9cb257a082f6160e882fa8fa5
7
- data.tar.gz: 678171b14e9da38d467d09ebf5a4a9db30520b467dcba16efb06b75ccc4868b44569e8d15ae280761ef724abfd34c84824dde56734bace91874b080098775375
6
+ metadata.gz: 4ab173be9d3c0fc4d5f3b72dd2ec56299347d00aeef9f66de8655fe3497a59485ec425500fd09c8f68892158056f4e7c5337db1125f9c6d51f55ad24be815f98
7
+ data.tar.gz: 74c9a5e05eb355731c486f1a84d7537f058f75cfe4d31eceedf6b9dc3748528ded19b8e013f7a2a3272c850d4e546dc3bd215a0434b79d05500d3a0aa023b07e
data/bin/zold CHANGED
@@ -124,6 +124,8 @@ Available options:"
124
124
  end
125
125
  end
126
126
 
127
+ log = Zold::Log::Sync.new(log)
128
+
127
129
  commands = opts.arguments.reject { |a| a.start_with?('-') }
128
130
  command = commands[0]
129
131
 
data/lib/zold/log.rb CHANGED
@@ -46,6 +46,40 @@ module Zold
46
46
  # messages. The user turns this mode by using --verbose command line argument.
47
47
  #
48
48
  module Log
49
+ # Synchronized
50
+ class Sync
51
+ def initialize(log)
52
+ @log = log
53
+ @mutex = Mutex.new
54
+ end
55
+
56
+ def debug(msg)
57
+ @mutex.synchronize do
58
+ @log.debug(msg)
59
+ end
60
+ end
61
+
62
+ def debug?
63
+ @log.debug?
64
+ end
65
+
66
+ def info(msg)
67
+ @mutex.synchronize do
68
+ @log.info(msg)
69
+ end
70
+ end
71
+
72
+ def info?
73
+ @log.info?
74
+ end
75
+
76
+ def error(msg)
77
+ @mutex.synchronize do
78
+ @log.error(msg)
79
+ end
80
+ end
81
+ end
82
+
49
83
  # Extra verbose log
50
84
  class Verbose
51
85
  def debug(msg)
@@ -94,7 +94,9 @@ module Zold
94
94
 
95
95
  # Always returns an array with a single ID of the pushed wallet
96
96
  def push(id, body)
97
- raise 'Queue is too long, try again later' if Dir.new(@dir).count > AsyncEntrance::MAX_QUEUE
97
+ if Dir.new(@dir).count > AsyncEntrance::MAX_QUEUE
98
+ raise "Queue is too long (#{Dir.new(@dir).count} wallets), try again later"
99
+ end
98
100
  @mutex.synchronize do
99
101
  AtomicFile.new(File.join(@dir, id.to_s)).write(body)
100
102
  end
data/lib/zold/version.rb CHANGED
@@ -25,6 +25,6 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.14.30'
28
+ VERSION = '0.14.31'
29
29
  PROTOCOL = 2
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.30
4
+ version: 0.14.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko