umbra-rb 0.1.0.pre → 0.1.1.pre

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: 9269f1f8cb887f1348c7dc266528db51ec778815e6a21d1ff262282507266fde
4
- data.tar.gz: 2a3d3e3ec3d357427f231d97b5691c335db1563f7c0281241269f230c84417a2
3
+ metadata.gz: 6ffe30c9f9401c33cb496523fa7533ff2602bfdae2e1d0536e3bb29c4c22b72f
4
+ data.tar.gz: 3deeee54a88f5fe55df575475bbbf965537f2ca177a80d8447d7ce9020590f10
5
5
  SHA512:
6
- metadata.gz: 53f1f7380ad448a9709ab73c01d201856a6441681f9f2db7e28193a77d9664a6f97dde71625858a6c9a63c2af2edf6fd503cc385273cb284e72024150347f61c
7
- data.tar.gz: 4e6aa9dcd30e586763458b49e14504f4788809fe1b753778b7f0a3f1bda011bc6ea1a9347fee3db45fb3d214f53c91ebf8aac0b7f9e1699de1457b740e7a30c8
6
+ metadata.gz: f98d2425fabc5006ac2eb310ab4a29dca3ed702f556c0c5e73a962ec0eaeecec062bcb2c6dd592e799b54441ac947ee69b6cd2173f2ecf97684acc62b41f9897
7
+ data.tar.gz: b4290db6259ec93725f93e8a1620727d1cde6aa46059ca19b95655fddf62a0f8f634d18b1af45f58d2f4a4c86b4872bcc9f5394ea4fdc3ca2c2b20880dfe2c49
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- umbra-rb (0.1.0.pre)
4
+ umbra-rb (0.1.1.pre)
5
5
  multi_json (~> 1.13)
6
6
  oj (~> 3.9)
7
7
  redis (~> 4.1)
data/README.md CHANGED
@@ -10,7 +10,7 @@ This can help you to build confidence in your infrasture by simulating elevated
10
10
  Add this to your `Gemfile`
11
11
 
12
12
  ```ruby
13
- gem 'umbra'
13
+ gem 'umbra-rb'
14
14
  ```
15
15
 
16
16
  And then execute:
@@ -19,7 +19,7 @@ And then execute:
19
19
 
20
20
  Or install it yourself as:
21
21
 
22
- $ gem install umbra
22
+ $ gem install umbra-rb
23
23
 
24
24
 
25
25
  ## Usage
@@ -1,9 +1,13 @@
1
1
  module Umbra
2
2
  class Publisher < SynchronousPublisher
3
+ MAX_QUEUE_SIZE = 100
4
+
3
5
  class << self
4
6
  def call(env, response)
5
7
  start_once!
6
8
 
9
+ return if @queue.size > MAX_QUEUE_SIZE
10
+
7
11
  @queue.push(proc { super(env, response) })
8
12
  end
9
13
 
@@ -22,6 +26,8 @@ module Umbra
22
26
 
23
27
  x.call
24
28
  end
29
+ rescue StandardError => e
30
+ Umbra.config.error_handler.call(e)
25
31
  end
26
32
 
27
33
  at_exit do
@@ -1,16 +1,19 @@
1
1
  module Umbra
2
2
  class ShadowRequester
3
- def initialize(count: 1, pool: 1)
3
+ def initialize(count: 1, pool: 1, max_queue_size: 100)
4
4
  @count = count
5
5
  @pool = pool
6
6
  @queue = Queue.new
7
7
  @stop = Object.new
8
8
  @lock = Mutex.new
9
+ @max_queue_size = max_queue_size
9
10
  end
10
11
 
11
12
  def call(env)
12
13
  start_worker!
13
14
 
15
+ return if @queue.size > @max_queue_size
16
+
14
17
  request = RequestBuilder.call(env)
15
18
 
16
19
  @count.times { @queue.push(request) }
@@ -31,6 +34,8 @@ module Umbra
31
34
 
32
35
  request.run
33
36
  end
37
+ rescue StandardError => e
38
+ Umbra.config.error_handler.call(e)
34
39
  end
35
40
  end
36
41
 
data/lib/umbra/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Umbra
4
- VERSION = '0.1.0.pre'
4
+ VERSION = '0.1.1.pre'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbra-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre
4
+ version: 0.1.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - carwow Developers
@@ -162,7 +162,6 @@ files:
162
162
  - lib/umbra/subscriber.rb
163
163
  - lib/umbra/synchronous_publisher.rb
164
164
  - lib/umbra/version.rb
165
- - umbra-0.1.0.pre.gem
166
165
  - umbra-rb.gemspec
167
166
  homepage: https://github.com/carwow/umbra
168
167
  licenses:
data/umbra-0.1.0.pre.gem DELETED
Binary file