allq 0.3.8 → 0.3.9
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/allq/client.rb +1 -1
- data/lib/allq/connection.rb +5 -16
- data/lib/allq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01b7850787c72b6525e92c9de5d8c92031f22400
|
4
|
+
data.tar.gz: e7e096efb7d8ade52b493b6ae6f63d7c6be145f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ff24d66cce5372cefe16da6a5c585823b363e5228bbf93da9196df6f5793544b51db6eecd56290f701fb23e48aea8bd0dc2b746425fcba8408a96b6bd20a62
|
7
|
+
data.tar.gz: 6e605b1a73b2e68455e06901dcda89329fa8feff0e8868fd894ad601f5a8dfe19feb75eb51b7e5a6330a2fe2515652967ddeac2b4517eed4aad387496c1845c5
|
data/lib/allq/client.rb
CHANGED
@@ -92,7 +92,7 @@ class AllQ
|
|
92
92
|
|
93
93
|
def reload!
|
94
94
|
@connection.close if @connection
|
95
|
-
puts "
|
95
|
+
puts "AllQ Connection Started --#{@url}"
|
96
96
|
@connection = AllQ::Connection.new(@url)
|
97
97
|
@get_action = AllQ::Get.new(@connection, self)
|
98
98
|
@put_action = AllQ::Put.new(@connection, self)
|
data/lib/allq/connection.rb
CHANGED
@@ -30,8 +30,6 @@ class AllQ
|
|
30
30
|
#
|
31
31
|
def initialize(address = '')
|
32
32
|
@address = address || _host_from_env
|
33
|
-
@mutex = Mutex.new
|
34
|
-
establish_connection
|
35
33
|
rescue
|
36
34
|
_raise_not_connected!
|
37
35
|
end
|
@@ -46,7 +44,7 @@ class AllQ
|
|
46
44
|
yield block.call(res)
|
47
45
|
end
|
48
46
|
|
49
|
-
def call_socat(data, timeout =
|
47
|
+
def call_socat(data, timeout = 3.0)
|
50
48
|
cmd_string = "echo '#{data}' | socat -t #{timeout} - tcp4-connect:#{@address}"
|
51
49
|
output = `#{cmd_string}`
|
52
50
|
return output
|
@@ -63,10 +61,9 @@ class AllQ
|
|
63
61
|
#
|
64
62
|
def transmit(command, options={}, &block)
|
65
63
|
_with_retry(options[:retry_interval], options[:init]) do
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
64
|
+
res = call_socat(command.to_s, 20.0)
|
65
|
+
raise "Socat failed after 20 seconds" if res.to_s == ""
|
66
|
+
yield block.call(res)
|
70
67
|
end
|
71
68
|
end
|
72
69
|
|
@@ -76,10 +73,6 @@ class AllQ
|
|
76
73
|
# @conn.close
|
77
74
|
#
|
78
75
|
def close
|
79
|
-
if @connection
|
80
|
-
@connection.close
|
81
|
-
@connection = nil
|
82
|
-
end
|
83
76
|
end
|
84
77
|
|
85
78
|
# Returns string representation of job.
|
@@ -102,11 +95,6 @@ class AllQ
|
|
102
95
|
# establish_connection('localhost:3005')
|
103
96
|
#
|
104
97
|
def establish_connection
|
105
|
-
@address = address.first if address.is_a?(Array)
|
106
|
-
match = address.split(':')
|
107
|
-
@host, @port = match[0], Integer(match[1] || DEFAULT_PORT)
|
108
|
-
|
109
|
-
@connection = TCPSocket.new @host, @port
|
110
98
|
end
|
111
99
|
|
112
100
|
private
|
@@ -121,6 +109,7 @@ class AllQ
|
|
121
109
|
def _with_retry(retry_interval, init=true, tries=MAX_RETRIES, &block)
|
122
110
|
yield
|
123
111
|
rescue => ex
|
112
|
+
sleep(tries) if tries > 0
|
124
113
|
_reconnect(ex, retry_interval)
|
125
114
|
retry
|
126
115
|
end
|
data/lib/allq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|