freno-client 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/freno-client.gemspec +15 -10
- data/lib/freno/client/preconditions.rb +1 -3
- data/lib/freno/client/version.rb +1 -1
- data/lib/freno/throttler.rb +13 -11
- metadata +10 -15
- data/.github/workflows/ruby.yml +0 -35
- data/.gitignore +0 -13
- data/.rubocop.yml +0 -44
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -32
- data/Gemfile +0 -18
- data/Rakefile +0 -15
- data/gemfiles/faraday_0.gemfile +0 -22
- data/gemfiles/faraday_1.gemfile +0 -22
- data/gemfiles/faraday_2.gemfile +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d770b3f1d5945dfd32db3e566c8881d0995afd0679e28e4eb1cb6275d0e44ee7
|
4
|
+
data.tar.gz: a16e811393f6a20ab6c8fd0ea75a870a824399d29c7d4051df9ee2801b461845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc6292fe3c1221bae5ac70f8f67145f5e2db18d23bb1f0c869d0c98e54d388348e9670495280e6f49e86991612a8a01d3109548ba4575cedb4289856751c09f1
|
7
|
+
data.tar.gz: 46d9b541781f7bc250e0cb038177cdf8327cae1090bef229b667309c98b06c9f042d34cc583b9ea091014313bc459849c0dcf4c8544ffef10523828433095399
|
data/freno-client.gemspec
CHANGED
@@ -3,26 +3,31 @@
|
|
3
3
|
require_relative "lib/freno/client/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
6
|
+
spec.name = "freno-client"
|
7
7
|
spec.version = Freno::Client::VERSION
|
8
|
-
spec.
|
9
|
-
spec.email = "opensource+freno-client@github.com"
|
10
|
-
|
11
|
-
spec.summary = "A library for interacting with Freno, the throttler service"
|
8
|
+
spec.summary = "A library for interacting with Freno, the throttler service"
|
12
9
|
spec.description = <<~DESC.gsub(/\s+/, " ")
|
13
10
|
freno-client is a Ruby library that interacts with Freno using HTTP.
|
14
11
|
Freno is a throttling service and its source code is available at
|
15
12
|
https://github.com/github/freno
|
16
13
|
DESC
|
17
14
|
|
15
|
+
spec.author = "GitHub"
|
16
|
+
spec.email = "opensource+freno-client@github.com"
|
17
|
+
spec.license = "MIT"
|
18
18
|
spec.homepage = "https://github.com/github/freno-client"
|
19
|
-
spec.license = "MIT"
|
20
|
-
|
21
|
-
spec.required_ruby_version = ">= 2.7.0"
|
22
19
|
|
23
|
-
spec.
|
20
|
+
spec.metadata = {
|
21
|
+
"allowed_push_host" => "https://rubygems.org",
|
22
|
+
"bug_tracker_uri" => "https://github.com/github/freno-client/issues",
|
23
|
+
"homepage_uri" => "https://github.com/github/freno-client",
|
24
|
+
"rubygems_mfa_required" => "true",
|
25
|
+
"source_code_uri" => "https://github.com/github/freno-client"
|
26
|
+
}
|
24
27
|
|
28
|
+
spec.required_ruby_version = ">= 3.0"
|
25
29
|
spec.add_dependency "faraday", "< 3"
|
26
30
|
|
27
|
-
spec.
|
31
|
+
spec.files = Dir.glob(["freno-client.gemspec", "lib/**/*.rb", "LICENSE.txt"])
|
32
|
+
spec.extra_rdoc_files = ["README.md"]
|
28
33
|
end
|
data/lib/freno/client/version.rb
CHANGED
data/lib/freno/throttler.rb
CHANGED
@@ -166,7 +166,7 @@ module Freno
|
|
166
166
|
instrument(:called, store_names: store_names)
|
167
167
|
waited = 0
|
168
168
|
|
169
|
-
|
169
|
+
while true
|
170
170
|
unless circuit_breaker.allow_request?
|
171
171
|
instrument(:circuit_open, store_names: store_names, waited: waited)
|
172
172
|
raise CircuitOpen
|
@@ -175,19 +175,21 @@ module Freno
|
|
175
175
|
if all_stores_ok?(store_names, **options)
|
176
176
|
instrument(:succeeded, store_names: store_names, waited: waited)
|
177
177
|
circuit_breaker.success
|
178
|
-
|
178
|
+
break
|
179
179
|
end
|
180
180
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
181
|
+
if waited + wait_seconds > max_wait_seconds
|
182
|
+
instrument(:waited_too_long, store_names: store_names, waited: waited, max: max_wait_seconds)
|
183
|
+
circuit_breaker.failure
|
184
|
+
raise WaitedTooLong.new(waited_seconds: waited, max_wait_seconds: max_wait_seconds)
|
185
|
+
else
|
186
|
+
wait
|
187
|
+
waited += wait_seconds
|
188
|
+
instrument(:waited, store_names: store_names, waited: waited, max: max_wait_seconds)
|
189
|
+
end
|
190
190
|
end
|
191
|
+
|
192
|
+
yield
|
191
193
|
end
|
192
194
|
|
193
195
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freno-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -29,21 +29,12 @@ description: 'freno-client is a Ruby library that interacts with Freno using HTT
|
|
29
29
|
email: opensource+freno-client@github.com
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
|
-
extra_rdoc_files:
|
32
|
+
extra_rdoc_files:
|
33
|
+
- README.md
|
33
34
|
files:
|
34
|
-
- ".github/workflows/ruby.yml"
|
35
|
-
- ".gitignore"
|
36
|
-
- ".rubocop.yml"
|
37
|
-
- CODE_OF_CONDUCT.md
|
38
|
-
- CONTRIBUTING.md
|
39
|
-
- Gemfile
|
40
35
|
- LICENSE.txt
|
41
36
|
- README.md
|
42
|
-
- Rakefile
|
43
37
|
- freno-client.gemspec
|
44
|
-
- gemfiles/faraday_0.gemfile
|
45
|
-
- gemfiles/faraday_1.gemfile
|
46
|
-
- gemfiles/faraday_2.gemfile
|
47
38
|
- lib/freno/client.rb
|
48
39
|
- lib/freno/client/errors.rb
|
49
40
|
- lib/freno/client/preconditions.rb
|
@@ -62,7 +53,11 @@ homepage: https://github.com/github/freno-client
|
|
62
53
|
licenses:
|
63
54
|
- MIT
|
64
55
|
metadata:
|
56
|
+
allowed_push_host: https://rubygems.org
|
57
|
+
bug_tracker_uri: https://github.com/github/freno-client/issues
|
58
|
+
homepage_uri: https://github.com/github/freno-client
|
65
59
|
rubygems_mfa_required: 'true'
|
60
|
+
source_code_uri: https://github.com/github/freno-client
|
66
61
|
post_install_message:
|
67
62
|
rdoc_options: []
|
68
63
|
require_paths:
|
@@ -71,14 +66,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
66
|
requirements:
|
72
67
|
- - ">="
|
73
68
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
69
|
+
version: '3.0'
|
75
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
71
|
requirements:
|
77
72
|
- - ">="
|
78
73
|
- !ruby/object:Gem::Version
|
79
74
|
version: '0'
|
80
75
|
requirements: []
|
81
|
-
rubygems_version: 3.
|
76
|
+
rubygems_version: 3.4.19
|
82
77
|
signing_key:
|
83
78
|
specification_version: 4
|
84
79
|
summary: A library for interacting with Freno, the throttler service
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
branches:
|
5
|
-
- main
|
6
|
-
pull_request:
|
7
|
-
branches:
|
8
|
-
- main
|
9
|
-
permissions:
|
10
|
-
contents: read
|
11
|
-
jobs:
|
12
|
-
test:
|
13
|
-
runs-on: ubuntu-latest
|
14
|
-
strategy:
|
15
|
-
matrix:
|
16
|
-
ruby-version:
|
17
|
-
- '2.7'
|
18
|
-
- '3.0'
|
19
|
-
- '3.1'
|
20
|
-
gemfile-path:
|
21
|
-
- Gemfile
|
22
|
-
- gemfiles/faraday_0.gemfile
|
23
|
-
- gemfiles/faraday_1.gemfile
|
24
|
-
- gemfiles/faraday_2.gemfile
|
25
|
-
env:
|
26
|
-
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile-path }}
|
27
|
-
steps:
|
28
|
-
- uses: actions/checkout@v3
|
29
|
-
- name: Set up Ruby
|
30
|
-
uses: ruby/setup-ruby@v1
|
31
|
-
with:
|
32
|
-
ruby-version: ${{ matrix.ruby-version }}
|
33
|
-
bundler-cache: true
|
34
|
-
- name: Run tests
|
35
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-minitest
|
3
|
-
- rubocop-performance
|
4
|
-
- rubocop-rake
|
5
|
-
|
6
|
-
AllCops:
|
7
|
-
NewCops: enable
|
8
|
-
TargetRubyVersion: 2.7
|
9
|
-
|
10
|
-
Layout/MultilineMethodCallIndentation:
|
11
|
-
Enabled: true
|
12
|
-
EnforcedStyle: indented_relative_to_receiver
|
13
|
-
|
14
|
-
Metrics:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Minitest/AssertEmptyLiteral:
|
18
|
-
Enabled: false
|
19
|
-
Minitest/AssertEqual:
|
20
|
-
Enabled: false
|
21
|
-
Minitest/AssertPredicate:
|
22
|
-
Enabled: false
|
23
|
-
Minitest/MultipleAssertions:
|
24
|
-
Enabled: false
|
25
|
-
Minitest/RefutePredicate:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Naming/RescuedExceptionsVariableName:
|
29
|
-
Enabled: true
|
30
|
-
PreferredName: error
|
31
|
-
|
32
|
-
Style/ClassAndModuleChildren:
|
33
|
-
Enabled: true
|
34
|
-
Exclude:
|
35
|
-
- test/**/*
|
36
|
-
Style/Documentation:
|
37
|
-
Enabled: false
|
38
|
-
Style/IfUnlessModifier:
|
39
|
-
Enabled: false
|
40
|
-
Style/StringLiterals:
|
41
|
-
Enabled: true
|
42
|
-
EnforcedStyle: double_quotes
|
43
|
-
Style/SymbolArray:
|
44
|
-
Enabled: false
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at opensource+freno-client@github.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
## Contributing
|
2
|
-
|
3
|
-
[fork]: https://github.com/github/freno-client/fork
|
4
|
-
[pr]: https://github.com/github/freno-client/compare
|
5
|
-
[style]: https://github.com/styleguide/ruby
|
6
|
-
[code-of-conduct]: CODE_OF_CONDUCT.md
|
7
|
-
|
8
|
-
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
9
|
-
|
10
|
-
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
|
11
|
-
|
12
|
-
## Submitting a pull request
|
13
|
-
|
14
|
-
0. [Fork][fork] and clone the freno-client repository
|
15
|
-
0. Configure and install the dependencies: `bin/setup`
|
16
|
-
0. Make sure the tests pass on your machine: `bin/test`
|
17
|
-
0. Create a new branch: `git checkout -b my-branch-name`
|
18
|
-
0. Make your change, add tests, and make sure the tests still pass
|
19
|
-
0. Push to your fork and [submit a pull request][pr]
|
20
|
-
0. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
21
|
-
|
22
|
-
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
23
|
-
|
24
|
-
- Write tests.
|
25
|
-
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
|
26
|
-
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
27
|
-
|
28
|
-
## Resources
|
29
|
-
|
30
|
-
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
31
|
-
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
32
|
-
- [GitHub Help](https://help.github.com)
|
data/Gemfile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gemspec
|
6
|
-
|
7
|
-
group :development do
|
8
|
-
gem "rake"
|
9
|
-
end
|
10
|
-
|
11
|
-
group :test do
|
12
|
-
gem "minitest", ">= 5"
|
13
|
-
gem "mocha"
|
14
|
-
gem "rubocop", "~> 1.37", require: false
|
15
|
-
gem "rubocop-minitest", require: false
|
16
|
-
gem "rubocop-performance", require: false
|
17
|
-
gem "rubocop-rake", require: false
|
18
|
-
end
|
data/Rakefile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
require "rake/testtask"
|
5
|
-
require "rubocop/rake_task"
|
6
|
-
|
7
|
-
Rake::TestTask.new(:test) do |t|
|
8
|
-
t.libs << "test"
|
9
|
-
t.libs << "lib"
|
10
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
11
|
-
end
|
12
|
-
|
13
|
-
RuboCop::RakeTask.new(:rubocop)
|
14
|
-
|
15
|
-
task default: [:test, :rubocop]
|
data/gemfiles/faraday_0.gemfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gemspec path: ".."
|
6
|
-
|
7
|
-
gem "faraday", "~> 0.0"
|
8
|
-
|
9
|
-
# Content below copied from Gemfile
|
10
|
-
|
11
|
-
group :development do
|
12
|
-
gem "rake"
|
13
|
-
end
|
14
|
-
|
15
|
-
group :test do
|
16
|
-
gem "minitest", ">= 5"
|
17
|
-
gem "mocha"
|
18
|
-
gem "rubocop", "~> 1.37", require: false
|
19
|
-
gem "rubocop-minitest", require: false
|
20
|
-
gem "rubocop-performance", require: false
|
21
|
-
gem "rubocop-rake", require: false
|
22
|
-
end
|
data/gemfiles/faraday_1.gemfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gemspec path: ".."
|
6
|
-
|
7
|
-
gem "faraday", "~> 1.0"
|
8
|
-
|
9
|
-
# Content below copied from Gemfile
|
10
|
-
|
11
|
-
group :development do
|
12
|
-
gem "rake"
|
13
|
-
end
|
14
|
-
|
15
|
-
group :test do
|
16
|
-
gem "minitest", ">= 5"
|
17
|
-
gem "mocha"
|
18
|
-
gem "rubocop", "~> 1.37", require: false
|
19
|
-
gem "rubocop-minitest", require: false
|
20
|
-
gem "rubocop-performance", require: false
|
21
|
-
gem "rubocop-rake", require: false
|
22
|
-
end
|
data/gemfiles/faraday_2.gemfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gemspec path: ".."
|
6
|
-
|
7
|
-
gem "faraday", "~> 2.0"
|
8
|
-
|
9
|
-
# Content below copied from Gemfile
|
10
|
-
|
11
|
-
group :development do
|
12
|
-
gem "rake"
|
13
|
-
end
|
14
|
-
|
15
|
-
group :test do
|
16
|
-
gem "minitest", ">= 5"
|
17
|
-
gem "mocha"
|
18
|
-
gem "rubocop", "~> 1.37", require: false
|
19
|
-
gem "rubocop-minitest", require: false
|
20
|
-
gem "rubocop-performance", require: false
|
21
|
-
gem "rubocop-rake", require: false
|
22
|
-
end
|