sqreen 1.1.41481804991 → 1.1.51482852304

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: f0d9c631d14ca94e904705fbadd947639b0353b7
4
- data.tar.gz: c38ee8e47603a5f1b0b21b4ff4d22699c7254c34
3
+ metadata.gz: 3a26aaa8da8d26dd436954f305fa4edd3012e1b4
4
+ data.tar.gz: 4149459209326187539244978f475f62d4596eb9
5
5
  SHA512:
6
- metadata.gz: 86a21565360f4ad945a4a5ace28df5797670754fbb96e68837b7f0e3e297b04636efbf91e293c171f84d5115459f81abc77d63668c4ca1a23dc9c9568c725259
7
- data.tar.gz: 0fb5ce9e34bb1fb9048b46d67c6b5f3a6342ec0787180985a234f626232f6516e7567318849596e4ab0c49dcc5f3ae5bcbeee2694c10b17b97d790eee2ce7a70
6
+ metadata.gz: ceb98979ac432d65cb3d01ba744a272e009978c8568fd112dc5cbf49e1717d80d35f5e6cf7e50eea5c36b427ca017a7aacf864b181aea8e0303d9f9d48586784
7
+ data.tar.gz: 0ccc23a42825667d824a2ec4e4e83d47c4242094c033c23a8f6b35715ad11b6c93f296b45950343390807b02c6ccafe83605df2333809561d5c75bfff04669f7
@@ -208,6 +208,7 @@ module Sqreen
208
208
 
209
209
  def do_heartbeat
210
210
  @last_heartbeat_request = Time.now
211
+ @next_metrics.concat(metrics_engine.publish(false)) if metrics_engine
211
212
  res = session.heartbeat(next_command_results, next_metrics)
212
213
  next_command_results.clear
213
214
  next_metrics.clear
@@ -246,6 +247,10 @@ module Sqreen
246
247
  end
247
248
  end
248
249
 
250
+ def heartbeat_needed?
251
+ (@last_heartbeat_request + heartbeat_delay) < Time.now
252
+ end
253
+
249
254
  def run_watcher_once
250
255
  event = Timeout.timeout(heartbeat_delay) do
251
256
  Sqreen.queue.pop
@@ -254,12 +259,11 @@ module Sqreen
254
259
  periodic_cleanup
255
260
  else
256
261
  handle_event(event)
257
- if (@last_heartbeat_request + HEARTBEAT_MAX_DELAY) < Time.now
258
- Sqreen.log.debug 'Forced an heartbeat'
259
- do_heartbeat
262
+ if heartbeat_needed?
260
263
  # Also aggregate/post metrics when cleanup has
261
264
  # not been done for a long time
262
- periodic_cleanup
265
+ Sqreen.log.debug 'Forced an heartbeat'
266
+ periodic_cleanup # will trigger do_heartbeat since it's time
263
267
  end
264
268
  end
265
269
 
@@ -269,11 +273,7 @@ module Sqreen
269
273
  # issue a simple heartbeat if it's time (which may return commands)
270
274
  @deliverer.tick
271
275
  aggregate_observations
272
- t = Time.now
273
- if (@last_heartbeat_request + heartbeat_delay) < t
274
- @next_metrics.concat(metrics_engine.publish(false)) if metrics_engine
275
- do_heartbeat
276
- end
276
+ do_heartbeat if heartbeat_needed?
277
277
  end
278
278
 
279
279
  def handle_event(event)
@@ -2,5 +2,5 @@
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
3
  # Warning This file is auto generated! DO NOT edit.
4
4
  module Sqreen
5
- VERSION = "1.1.41481804991".freeze
5
+ VERSION = "1.1.51482852304".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqreen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.41481804991
4
+ version: 1.1.51482852304
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sqreen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-15 00:00:00.000000000 Z
11
+ date: 2016-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs