meeseeks 0.1.6 → 0.1.7

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
  SHA256:
3
- metadata.gz: b0d4c7a27c97234ae282021ea371b3d0916ac6205c7a48e779716a019cd4bc6e
4
- data.tar.gz: 04c1a09f0b94532db4e23a9ff3dad70ca5953e8340e79fbb3ba938710593e3f7
3
+ metadata.gz: 4ad8f7a1d3b3d90506c58b5cdb6213f3e22ee75262c252e8c892eef64825763c
4
+ data.tar.gz: d64864ea00952fc76f2f3660a79540d9002d4c2dd29dff7125b7898fa44c8d36
5
5
  SHA512:
6
- metadata.gz: 7a1113d5b353faaa9d4673b4853aeabb27c2f883ced1e02892e83063d86d7f6123a975bbcea93b102178e59ed0b2671321a5aa97bfe014930963cf8e3484bacf
7
- data.tar.gz: dfab9865148653e8c4936ed9b02e90fa4ba8cd38f47a8aa2c61a82529b66b192de589560f64c869b2c342942af6d88feb7a82bf1db5238ebc8195b14b01a1acd
6
+ metadata.gz: 69d274bd2e7fb007c8f6580d4e99a3a40911ce1a14f3190bbdff4ff98799a6d53fefa76025b789b943373b994f3b651ba60a06b3070e05aa75aeb38c533977c0
7
+ data.tar.gz: 6e0b68f4d94018ef85dcf0af751b6f621c1a96d869fd64520ee4b4f01ec5d994cd1922f338a56447871630ae21c9be1f7b5eaca8c5f6f0cf13b3d09ecc600fee
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meeseeks (0.1.6)
4
+ meeseeks (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Makefile CHANGED
@@ -12,16 +12,16 @@ build:
12
12
  docker build -t coup-mobility/meeseeks .
13
13
 
14
14
  bump-patch:
15
- docker-compose run meeseeks gem bump --version patch
15
+ gem bump --version patch
16
16
 
17
17
  bump-minor:
18
- docker-compose run meeseeks gem bump --version minor
18
+ gem bump --version minor
19
19
 
20
20
  bump-major:
21
- docker-compose run meeseeks gem bump --version major
21
+ gem bump --version major
22
22
 
23
23
  release:
24
- docker-compose run meeseeks rake release
24
+ rake release
25
25
 
26
26
  bundle:
27
27
  docker-compose run meeseeks bash -l -c "bundle check || bundle install"
@@ -17,6 +17,7 @@ module Meeseeks
17
17
  interval: nil,
18
18
  max_batch_size: nil,
19
19
  max_queue_size: nil)
20
+ @imploded = false
20
21
  @queue = Queue.new
21
22
  @interval = interval || ENV.fetch('MEESEEKS_INTERVAL', 60).to_i
22
23
  @max_queue_size = max_queue_size ||
@@ -25,16 +26,16 @@ module Meeseeks
25
26
  ENV.fetch('MEESEEKS_MAX_BATCH_SIZE', 1_000).to_i
26
27
  @data_submission_url = data_submission_url ||
27
28
  ENV.fetch('MEESEEKS_DATA_SUBMISSION_URL')
28
-
29
- create_http_trap
30
- start_harvester
29
+ start
31
30
  end
32
31
 
33
32
  def record!(group, metric, value, time = DateTime.now)
34
- Payload.validate_type!(value)
33
+ return false if @imploded
35
34
  return false if @queue.size >= @max_queue_size
36
35
 
36
+ Payload.validate_type!(value)
37
37
  @queue.push(Payload.for_group(group, metric, value, time))
38
+
38
39
  true
39
40
  end
40
41
 
@@ -48,12 +49,28 @@ module Meeseeks
48
49
  {
49
50
  queue_size: @queue.size,
50
51
  harvester: @harvester.stats,
51
- http_trap: @http_trap.stats
52
+ http_trap: @http_trap.stats,
53
+ imploded: @imploded
52
54
  }
53
55
  end
54
56
 
57
+ def implode!
58
+ return if @imploded
59
+
60
+ @imploded = true
61
+ harvester.stop
62
+ harvester.kill
63
+ queue.clear
64
+ queue.close
65
+ end
66
+
55
67
  private
56
68
 
69
+ def start
70
+ create_http_trap
71
+ start_harvester
72
+ end
73
+
57
74
  def create_http_trap
58
75
  @http_trap = HTTPTrap.new(@data_submission_url)
59
76
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meeseeks
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
data/lib/meeseeks.rb CHANGED
@@ -8,12 +8,20 @@ module Meeseeks
8
8
  extend SingleForwardable
9
9
 
10
10
  def self.instance
11
- @instance ||= Meeseeks.new(*@configuration || {})
11
+ @instance ||= Meeseeks.new(*(@configuration || {}))
12
12
  end
13
13
 
14
14
  def self.configure(*args)
15
15
  @configuration = args
16
16
  end
17
17
 
18
- def_delegators :instance, *::Meeseeks::Meeseeks.instance_methods(false)
18
+ def self.implode!
19
+ @instance&.implode!
20
+ @instance = nil
21
+ end
22
+
23
+ def_delegators(
24
+ :instance,
25
+ *(::Meeseeks::Meeseeks.instance_methods(false) - [:implode!])
26
+ )
19
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meeseeks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jannis Hermanns
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2018-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler