berater 0.15.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/berater/limiter.rb +6 -4
- data/lib/berater/middleware/fail_open.rb +5 -2
- data/lib/berater/middleware/trace.rb +1 -1
- data/lib/berater/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcfe29f7b98bcd132e05ba7cadbc05a128da9f4737eaa383e330bfd4d72832fb
|
4
|
+
data.tar.gz: 7750d96b8df130de0e9dd11c81f69b021543567c6e7f63087839dc17bbaf309c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17e3d67ebdc5644348011b1d03b5850bceeeae4533d25a6a67f1cdadf8071312c0a397ae15560f01ad7ef123f68dfd7a19c55040ff5af5b7c17883f0c33f265
|
7
|
+
data.tar.gz: 95d37d05e057c5b536ce724308a91f1be09211a3e3687dced98618f5836d9d992b4dfb51f00b074a65dd36e9664344b032703f02c9883600db348b411b2f18e2
|
data/lib/berater/limiter.rb
CHANGED
@@ -52,10 +52,12 @@ module Berater
|
|
52
52
|
|
53
53
|
acquire_lock(capacity: capacity, cost: cost, **opts)
|
54
54
|
rescue NoMethodError => e
|
55
|
-
|
55
|
+
if e.message.include?("undefined method `evalsha' for")
|
56
|
+
# repackage error so it's easier to understand
|
57
|
+
raise RuntimeError, "invalid redis connection: #{redis}"
|
58
|
+
end
|
56
59
|
|
57
|
-
|
58
|
-
raise RuntimeError, "invalid redis connection: #{redis}"
|
60
|
+
raise
|
59
61
|
end
|
60
62
|
|
61
63
|
def utilization
|
@@ -111,7 +113,7 @@ module Berater
|
|
111
113
|
@capacity = capacity
|
112
114
|
end
|
113
115
|
|
114
|
-
def acquire_lock(
|
116
|
+
def acquire_lock(**options)
|
115
117
|
raise NotImplementedError
|
116
118
|
end
|
117
119
|
|
@@ -3,9 +3,12 @@ require 'set'
|
|
3
3
|
module Berater
|
4
4
|
module Middleware
|
5
5
|
class FailOpen
|
6
|
-
ERRORS = Set[
|
6
|
+
ERRORS = Set.new [
|
7
7
|
Redis::BaseConnectionError,
|
8
|
-
|
8
|
+
SystemCallError, # openssl
|
9
|
+
Timeout::Error, # connection pool
|
10
|
+
(OpenSSL::OpenSSLError if defined?(OpenSSL)),
|
11
|
+
].compact
|
9
12
|
|
10
13
|
def initialize(errors: nil, on_fail: nil)
|
11
14
|
@errors = errors || ERRORS
|
data/lib/berater/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: meddleware
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
- !ruby/object:Gem::Version
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
|
-
rubygems_version: 3.
|
207
|
+
rubygems_version: 3.2.33
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: Berater
|