sps-pub 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -5
- data.tar.gz.sig +3 -2
- data/lib/sps-pub.rb +35 -3
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c91d44b43fef7ae091fab8f32c6480e139d5d5
|
4
|
+
data.tar.gz: 45c21e14f76fca058a807113cbc60a529a3a22cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2feb85533ff56a7d5bedebc2bfca6f2478195054921e53ae4e7b8836bfe3e87998d7a963103e741f1e7ed1714152e1fb978781957f216ffee96e9dff5317fa43
|
7
|
+
data.tar.gz: 0f74e3a7ac22a7134635aeca86e588f1c6338ef9f53c01c9243d8599c460e0d09cbc4b730cc42df164300cfc75534e15743b7e2b01e820c2adadbfd356b4bf80
|
checksums.yaml.gz.sig
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
� !9Z�{��sR�S[q8~�p��T(�p-5�n1�$��=K��p:���rH����°l�
|
5
|
-
�l����b!�mj��0�`8E�YdFbY0E956��`q�b����>M|�dJ�ٮS屁Y�IR�
|
1
|
+
���%�k�r&0t���_i9D��6נ��qY��ҍ�s:2
|
2
|
+
�Cj�g���5)��O!�a��yk<�b`t��n)_�.E�\�{�o�$�َ��/@W䙥��?uC�_I�TC�e
|
3
|
+
�B���j�1�k�Є���G��c8�s�$��("�%4�$�J�{��5�t��BX��]3�Q����"c�Wʔ�V��AxH�3YBZ�V��ۑ(r���: ��z^��3�c�M(I���0���d.�,���;���,Ᏹ
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�%�e;� !�,�UNN����'��^����G�V
|
2
|
+
��%p��G�?b���0ڌWCq?�e%�X�ȱ!;��Y��"ڴ�<m��J�%kEV�������¾�"W�]�5x�(m�*_���)��dK���s7{�6�{���ۍ�h5�2۬��Z�%��C
|
3
|
+
�`\��hD��?�U-v� �x��ٯ��niB�>��]�$��+-C�f>'����!7�7�p��V�U���F@��aMIDq��ߘ�
|
data/lib/sps-pub.rb
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
require 'websocket-client-simple'
|
6
6
|
|
7
7
|
|
8
|
+
class SPSPubError < Exception
|
9
|
+
end
|
10
|
+
|
11
|
+
|
8
12
|
class SPSPub
|
9
13
|
|
10
14
|
def initialize(host: 'sps', address: host, port: '59000')
|
@@ -22,10 +26,33 @@ class SPSPub
|
|
22
26
|
alias publish notice
|
23
27
|
|
24
28
|
def self.notice(s, hostx='sps', host: hostx, address: host,
|
25
|
-
port: '59000', retries: 3)
|
29
|
+
port: '59000', retries: 3, hosts: [])
|
30
|
+
|
26
31
|
|
32
|
+
ws = nil
|
33
|
+
begin
|
34
|
+
|
35
|
+
if hosts.any? then
|
36
|
+
address, portx = hosts.first.split(':', 2)
|
37
|
+
|
38
|
+
portx ||= port
|
39
|
+
port = portx
|
40
|
+
end
|
27
41
|
|
28
|
-
|
42
|
+
ws = WebSocket::Client::Simple.connect "ws://%s:%s/" % [address, port]
|
43
|
+
rescue Errno::ECONNREFUSED => e
|
44
|
+
|
45
|
+
if hosts.any? then
|
46
|
+
hosts.rotate!
|
47
|
+
puts 'retrying ...' + hosts.inspect
|
48
|
+
sleep 0.1
|
49
|
+
#self.notice s, hosts: hosts.rotate
|
50
|
+
retry
|
51
|
+
else
|
52
|
+
raise SPSPubError, "connection refused"
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
29
56
|
|
30
57
|
ws.on :open do
|
31
58
|
|
@@ -34,7 +61,11 @@ class SPSPub
|
|
34
61
|
begin
|
35
62
|
|
36
63
|
ws.send s
|
37
|
-
|
64
|
+
|
65
|
+
#exception
|
66
|
+
|
67
|
+
rescue Exception => e
|
68
|
+
puts 'dig it'
|
38
69
|
rescue Errno::ETIMEDOUT => e
|
39
70
|
|
40
71
|
if retries and retry_attempts < retries then
|
@@ -46,6 +77,7 @@ class SPSPub
|
|
46
77
|
else
|
47
78
|
puts 'SPSPub timeout while trying to contact the host'
|
48
79
|
end
|
80
|
+
|
49
81
|
|
50
82
|
end
|
51
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sps-pub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
Ke//2Urv5XozW5nKniqR+yI7YVIlgDHWEjHdlCaQH3fMHsliDCeDF/lxRd902EDM
|
32
32
|
pCvgnGqKZoDb7g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-
|
34
|
+
date: 2017-05-20 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: websocket-client-simple
|
metadata.gz.sig
CHANGED
Binary file
|