umbra-rb 0.1.0.pre → 0.1.1.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/umbra/publisher.rb +6 -0
- data/lib/umbra/shadow_requester.rb +6 -1
- data/lib/umbra/version.rb +1 -1
- metadata +1 -2
- data/umbra-0.1.0.pre.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ffe30c9f9401c33cb496523fa7533ff2602bfdae2e1d0536e3bb29c4c22b72f
|
4
|
+
data.tar.gz: 3deeee54a88f5fe55df575475bbbf965537f2ca177a80d8447d7ce9020590f10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f98d2425fabc5006ac2eb310ab4a29dca3ed702f556c0c5e73a962ec0eaeecec062bcb2c6dd592e799b54441ac947ee69b6cd2173f2ecf97684acc62b41f9897
|
7
|
+
data.tar.gz: b4290db6259ec93725f93e8a1620727d1cde6aa46059ca19b95655fddf62a0f8f634d18b1af45f58d2f4a4c86b4872bcc9f5394ea4fdc3ca2c2b20880dfe2c49
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
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
|
data/lib/umbra/publisher.rb
CHANGED
@@ -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
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.
|
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
|