Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
a6298c1d
Unverified
Commit
a6298c1d
authored
Jan 21, 2020
by
Ge Jun
Committed by
GitHub
Jan 21, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1005 from TousakaRin/circuit_breaker
ignore ELIMIT for circuit breaker
parents
2fe49c9b
e67b3bbd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
circuit_breaker.cpp
src/brpc/circuit_breaker.cpp
+16
-3
No files found.
src/brpc/circuit_breaker.cpp
View file @
a6298c1d
...
...
@@ -15,10 +15,13 @@
// specific language governing permissions and limitations
// under the License.
#include "brpc/circuit_breaker.h"
#include <cmath>
#include <gflags/gflags.h>
#include <butil/time.h>
#include "brpc/circuit_breaker.h"
#include "brpc/errno.pb.h"
#include "butil/time.h"
namespace
brpc
{
...
...
@@ -57,7 +60,7 @@ namespace {
#define EPSILON (FLAGS_circuit_breaker_epsilon_value)
}
// namepace
}
// name
s
pace
CircuitBreaker
::
EmaErrorRecorder
::
EmaErrorRecorder
(
int
window_size
,
int
max_error_percent
)
...
...
@@ -172,6 +175,16 @@ CircuitBreaker::CircuitBreaker()
}
bool
CircuitBreaker
::
OnCallEnd
(
int
error_code
,
int64_t
latency
)
{
// If the server has reached its maximum concurrency, it will return
// ELIMIT directly when a new request arrives. This usually means that
// the entire downstream cluster is overloaded. If we isolate nodes at
// this time, may increase the pressure on downstream. On the other hand,
// since the latency corresponding to ELIMIT is usually very small, we
// cannot handle it as a successful request. Here we simply ignore the requests
// that returned ELIMIT.
if
(
error_code
==
ELIMIT
)
{
return
true
;
}
if
(
_broken
.
load
(
butil
::
memory_order_relaxed
))
{
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment