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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00b276ca8003a18a9ffca97432d7386bb0c344a9
4
- data.tar.gz: 37453ec20c3eaccced7004add88817c6f992a454
3
+ metadata.gz: 7e55bed6bd3c1a29dc97660dc20e4cef5baa4f2f
4
+ data.tar.gz: 4b4e5da9700ee2f655d4275e49b309caa802feb4
5
5
  SHA512:
6
- metadata.gz: d0c5316dd50e880aa1680fda80bd00f7f74fa7d9444bf48065f96d71b8ba0d0e214cae79e5602b5059786154512a42fe6e05f5e694dbf9b9bb194254cec1c478
7
- data.tar.gz: 974ad4cc0b96d1a09cd0ef449b22d95c329d094b0d1c534e50e749c008c4f93edc113ca8a62fbbc7a860be72a78a1387fcf17e7d7906a85207ce10d15effcb23
6
+ metadata.gz: c3a74e72ac3690ee6c1fd4868ccce50999d1b1ba1fa04766f6fdd5d8af5c66f2dff787654ed5f020321f23c805fbfdd0b8e8b8b4460e8aa60c23409a74f9469a
7
+ data.tar.gz: dc0df48da9f9f37d0cca3e72ff49668310f241d5a6921d2030e01f153d4d826c0c72bfa4e10f0906a4978e07e6c6f3d40dd943bbd8fdf0a3ae040e135b951d34
@@ -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"
@@ -1,6 +1,7 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  addons:
4
+ srcclr: true
4
5
  code_climate:
5
6
  repo_token: 48739096f72763cbed9bd407efd2ed33151ce5663fb3181455128f06d6123ef3
6
7
 
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.18
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.25
1
+ 4.0.27
@@ -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
- @app.record_telemetry(@telemetry_name, telemetry_time_start, ::Time.now.to_f)
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)
@@ -8,22 +8,36 @@ module Pubnub
8
8
  end
9
9
 
10
10
  def record_request(telemetry_type, time_start, time_end)
11
- @timers[telemetry_type] = every(1) { @good_to_go[telemetry_type] = true } unless @timers[telemetry_type]
12
- @recorded_history[telemetry_type] ||= []
13
- @recorded_history[telemetry_type] << time_end - time_start
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
- @recorded_history[telemetry_type] ||= []
18
- return false if !@good_to_go[telemetry_type] || @recorded_history[telemetry_type].size == 0
19
- average = @recorded_history[telemetry_type].reduce(0, :+) / @recorded_history[telemetry_type].size
20
- clear!(telemetry_type)
21
- average
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
- @recorded_history[telemetry_type] = []
26
- @good_to_go[telemetry_type] = false
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
@@ -4,11 +4,15 @@ module Pubnub
4
4
  module UUID
5
5
  class << self
6
6
  def generate
7
- arr = Random.new.bytes(16).unpack('NnnnnN')
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
@@ -1,4 +1,4 @@
1
1
  # Toplevel Pubnub module.
2
2
  module Pubnub
3
- VERSION = '4.0.25'
3
+ VERSION = '4.0.27'
4
4
  end
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.25
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-09-22 00:00:00.000000000 Z
11
+ date: 2017-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid