Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/codecov/codecov-ac…
Browse files Browse the repository at this point in the history
…tion-4
  • Loading branch information
dpep authored Aug 8, 2024
2 parents 46e6443 + 486bab0 commit f9ec9db
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
run: gh pr checkout ${{github.event.pull_request.number}}
- name: Fetch PR metadata
id: metadata
uses: dependabot/fetch-metadata@v1
uses: dependabot/fetch-metadata@v2
- name: Approve PR
run: |
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v0.15.1 (2024-02-06)
- fail open errors
- simplify
- scope exception catching

### v0.15.0 (2023-10-13)
- drop ddog 0.54
- add lockfile
Expand Down
65 changes: 34 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,55 +1,58 @@
PATH
remote: .
specs:
berater (0.15.0)
berater (0.15.1)
meddleware (>= 0.3)
redis (>= 3)

GEM
remote: https://rubygems.org/
specs:
benchmark (0.2.0)
benchmark (0.3.0)
byebug (11.1.3)
connection_pool (2.4.1)
ddtrace (1.2.0)
debase-ruby_core_source (= 0.10.16)
libddprof (~> 0.6.0.1.0)
libddwaf (~> 1.3.0.2.0)
datadog-ci (0.8.3)
msgpack
debase-ruby_core_source (0.10.16)
diff-lcs (1.5.0)
ddtrace (1.23.0)
datadog-ci (~> 0.8.1)
debase-ruby_core_source (= 3.3.1)
libdatadog (~> 7.0.0.1.0)
libddwaf (~> 1.14.0.0.0)
msgpack
debase-ruby_core_source (3.3.1)
diff-lcs (1.5.1)
docile (1.4.0)
dogstatsd-ruby (5.5.0)
ffi (1.15.5)
libddprof (0.6.0.1.0)
libddwaf (1.3.0.2.0)
dogstatsd-ruby (5.6.1)
ffi (1.17.0)
libdatadog (7.0.0.1.0)
libddwaf (1.14.0.0.0)
ffi (~> 1.0)
meddleware (0.3.0)
msgpack (1.5.3)
redis (5.0.7)
redis-client (>= 0.9.0)
redis-client (0.17.0)
meddleware (0.4.0)
msgpack (1.7.2)
redis (5.2.0)
redis-client (>= 0.22.0)
redis-client (0.22.2)
connection_pool
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.1)
simplecov (0.21.2)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
timecop (0.9.5)
timecop (0.9.9)

PLATFORMS
ruby
Expand All @@ -65,4 +68,4 @@ DEPENDENCIES
timecop

BUNDLED WITH
2.3.17
2.5.10
4 changes: 1 addition & 3 deletions berater.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ Gem::Specification.new do |s|
s.description = 'work...within limits'
s.homepage = "https://github.com/dpep/#{package_name}_rb"
s.license = 'MIT'

s.files = Dir.glob('lib/**/*')
s.test_files = Dir.glob('spec/**/*_spec.rb')
s.files = `git ls-files * ':!:spec'`.split("\n")

s.required_ruby_version = '>= 3'

Expand Down
10 changes: 6 additions & 4 deletions lib/berater/limiter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ def limit(**opts, &block)

acquire_lock(capacity: capacity, cost: cost, **opts)
rescue NoMethodError => e
raise unless e.message.include?("undefined method `evalsha' for")
if e.message.include?("undefined method `evalsha' for")
# repackage error so it's easier to understand
raise RuntimeError, "invalid redis connection: #{redis}"
end

# repackage error so it's easier to understand
raise RuntimeError, "invalid redis connection: #{redis}"
raise
end

def utilization
Expand Down Expand Up @@ -111,7 +113,7 @@ def capacity=(capacity)
@capacity = capacity
end

def acquire_lock(capacity:, cost:)
def acquire_lock(**options)
raise NotImplementedError
end

Expand Down
7 changes: 5 additions & 2 deletions lib/berater/middleware/fail_open.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
module Berater
module Middleware
class FailOpen
ERRORS = Set[
ERRORS = Set.new [
Redis::BaseConnectionError,
]
SystemCallError, # openssl
Timeout::Error, # connection pool
(OpenSSL::OpenSSLError if defined?(OpenSSL)),
].compact

def initialize(errors: nil, on_fail: nil)
@errors = errors || ERRORS
Expand Down
2 changes: 1 addition & 1 deletion lib/berater/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Berater
VERSION = "0.15.0"
VERSION = "0.15.1"
end

0 comments on commit f9ec9db

Please sign in to comment.