pubnub 4.0.25 → 4.0.27
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pubnub might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.pubnub.yml +17 -2
- data/.travis.yml +1 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/pubnub/event.rb +10 -5
- data/lib/pubnub/telemetry.rb +24 -10
- data/lib/pubnub/uuid.rb +5 -1
- data/lib/pubnub/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: 7e55bed6bd3c1a29dc97660dc20e4cef5baa4f2f
|
4
|
+
data.tar.gz: 4b4e5da9700ee2f655d4275e49b309caa802feb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a74e72ac3690ee6c1fd4868ccce50999d1b1ba1fa04766f6fdd5d8af5c66f2dff787654ed5f020321f23c805fbfdd0b8e8b8b4460e8aa60c23409a74f9469a
|
7
|
+
data.tar.gz: dc0df48da9f9f37d0cca3e72ff49668310f241d5a6921d2030e01f153d4d826c0c72bfa4e10f0906a4978e07e6c6f3d40dd943bbd8fdf0a3ae040e135b951d34
|
data/.pubnub.yml
CHANGED
@@ -1,5 +1,20 @@
|
|
1
|
-
---
|
1
|
+
---
|
2
|
+
version: "4.0.27"
|
2
3
|
changelog:
|
4
|
+
-
|
5
|
+
changes:
|
6
|
+
-
|
7
|
+
text: "Fixed telemetry issues."
|
8
|
+
type: bugfix
|
9
|
+
date: 17-11-2017
|
10
|
+
version: "4.0.27"
|
11
|
+
-
|
12
|
+
changes:
|
13
|
+
-
|
14
|
+
text: "Secured telemetry call. Fixed crash when an app was exiting."
|
15
|
+
type: bugfix
|
16
|
+
date: 23-10-2017
|
17
|
+
version: "4.0.26"
|
3
18
|
-
|
4
19
|
changes:
|
5
20
|
-
|
@@ -242,6 +257,7 @@ features:
|
|
242
257
|
- STORAGE-INCLUDE-TIMETOKEN
|
243
258
|
- STORAGE-START-END
|
244
259
|
- STORAGE-COUNT
|
260
|
+
- STORAGE-DELETE-MESSAGES
|
245
261
|
subscribe:
|
246
262
|
- SUBSCRIBE-CHANNELS
|
247
263
|
- SUBSCRIBE-CHANNEL-GROUPS
|
@@ -270,4 +286,3 @@ supported-platforms:
|
|
270
286
|
- "Windows 7 or later, amd64, 386, use rubyinstaller and dev pack."
|
271
287
|
- "Apart from the above, PubNub Ruby SDK works on mostly all platforms where the supported Ruby versions work. To use ssl connection, Ruby should be compiled with openssl support."
|
272
288
|
version: "PubNub Ruby SDK"
|
273
|
-
version: "4.0.23"
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# Complete Documentation
|
8
8
|
Available at https://www.pubnub.com/docs/ruby/pubnub-ruby-sdk-v4 **v4.x**
|
9
9
|
|
10
|
-
## PubNub Gem version 4.0.
|
10
|
+
## PubNub Gem version 4.0.27
|
11
11
|
|
12
12
|
##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API.
|
13
13
|
##### http://www.pubnub.com/account
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.0.
|
1
|
+
4.0.27
|
data/lib/pubnub/event.rb
CHANGED
@@ -28,6 +28,8 @@ module Pubnub
|
|
28
28
|
format_group
|
29
29
|
set_timestamp
|
30
30
|
validate!
|
31
|
+
telemetry = @app.telemetry_for(@telemetry_name)
|
32
|
+
@current_telemetry = telemetry ? telemetry.round(3) : nil
|
31
33
|
Pubnub.logger.debug('Pubnub::Event') { "Initialized #{self.class}" }
|
32
34
|
end
|
33
35
|
|
@@ -58,11 +60,15 @@ module Pubnub
|
|
58
60
|
response = sender.post(uri.to_s, body: compressed_body)
|
59
61
|
end
|
60
62
|
|
61
|
-
|
63
|
+
begin
|
64
|
+
@app.record_telemetry(@telemetry_name, telemetry_time_start, ::Time.now.to_f)
|
65
|
+
rescue => error
|
66
|
+
Pubnub.logger.warn('Pubnub::Event') { "Couldn't record telemetry because of #{error}\n#{error.backtrace.join("\n")}" }
|
67
|
+
end
|
62
68
|
|
63
69
|
return response
|
64
|
-
|
65
70
|
rescue => error
|
71
|
+
Pubnub.logger.error('Pubnub::Event'){ error }
|
66
72
|
error
|
67
73
|
end
|
68
74
|
|
@@ -73,14 +79,12 @@ module Pubnub
|
|
73
79
|
end
|
74
80
|
|
75
81
|
sa_signature = super_admin_signature unless parameters.include?(:signature)
|
76
|
-
telemetry = @app.telemetry_for(@telemetry_name)
|
77
82
|
|
78
83
|
uri = @ssl ? 'https://' : 'http://'
|
79
84
|
uri += @origin
|
80
85
|
uri += path
|
81
86
|
uri += '?' + Formatter.params_hash_to_url_params(parameters)
|
82
87
|
uri += "&signature=#{sa_signature}" if sa_signature
|
83
|
-
uri += "&#{@telemetry_name}=#{telemetry.round(3)}" if telemetry
|
84
88
|
Pubnub.logger.debug('Pubnub::Event') { "Requested URI: #{uri}" }
|
85
89
|
URI uri
|
86
90
|
end
|
@@ -114,7 +118,8 @@ module Pubnub
|
|
114
118
|
|
115
119
|
empty_if_blank = {
|
116
120
|
auth: @auth_key,
|
117
|
-
uuid: @app.env[:uuid]
|
121
|
+
uuid: @app.env[:uuid],
|
122
|
+
@telemetry_name => @current_telemetry
|
118
123
|
}
|
119
124
|
|
120
125
|
required.merge!(timestamp: @timestamp) if @app.env[:secret_key] && ![:grant, :revoke, :audit].include?(@event)
|
data/lib/pubnub/telemetry.rb
CHANGED
@@ -8,22 +8,36 @@ module Pubnub
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def record_request(telemetry_type, time_start, time_end)
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
begin
|
12
|
+
@timers[telemetry_type] = every(1) { @good_to_go[telemetry_type] = true } unless @timers[telemetry_type]
|
13
|
+
@recorded_history[telemetry_type] ||= []
|
14
|
+
@recorded_history[telemetry_type] << time_end - time_start
|
15
|
+
rescue => error
|
16
|
+
Pubnub.logger.error('Pubnub::Telemetry'){ "Failed to record request #{error}\n#{error.backtrace.join("\n")}" }
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
def fetch_average(telemetry_type)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
begin
|
22
|
+
Pubnub.logger.debug('Pubnub::Telemetry'){ "Fetching telemetry for #{telemetry_type}" }
|
23
|
+
@recorded_history[telemetry_type] ||= []
|
24
|
+
return false if !@good_to_go[telemetry_type] || @recorded_history[telemetry_type].size == 0
|
25
|
+
average = @recorded_history[telemetry_type].reduce(0, :+) / @recorded_history[telemetry_type].size
|
26
|
+
clear!(telemetry_type)
|
27
|
+
Pubnub.logger.debug('Pubnub::Telemetry'){ "Current average: #{average}" }
|
28
|
+
average
|
29
|
+
rescue => error
|
30
|
+
Pubnub.logger.error('Pubnub::Telemetry'){ "Failed to fetch average #{error}\n#{error.backtrace.join("\n")}" }
|
31
|
+
end
|
22
32
|
end
|
23
33
|
|
24
34
|
def clear!(telemetry_type)
|
25
|
-
|
26
|
-
|
35
|
+
begin
|
36
|
+
@recorded_history[telemetry_type] = []
|
37
|
+
@good_to_go[telemetry_type] = false
|
38
|
+
rescue => error
|
39
|
+
Pubnub.logger.error('Pubnub::Telemetry'){ "Failed to clear telemetry #{error}\n#{error.backtrace.join("\n")}" }
|
40
|
+
end
|
27
41
|
end
|
28
42
|
end
|
29
43
|
end
|
data/lib/pubnub/uuid.rb
CHANGED
@@ -4,11 +4,15 @@ module Pubnub
|
|
4
4
|
module UUID
|
5
5
|
class << self
|
6
6
|
def generate
|
7
|
-
arr =
|
7
|
+
arr = random_bytes_array
|
8
8
|
arr[2] = (arr[2] & 0x0fff) | 0x4000
|
9
9
|
arr[3] = (arr[3] & 0x3fff) | 0x8000
|
10
10
|
format('%08x-%04x-%04x-%04x-%04x%08x', *arr)
|
11
11
|
end
|
12
|
+
|
13
|
+
def random_bytes_array
|
14
|
+
Random.new.bytes(16).unpack('NnnnnN')
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
data/lib/pubnub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubnub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PubNub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|