Skip to content

Commit

Permalink
[Improve] Hystrix Timeout (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
crudboy authored Oct 11, 2023
1 parent 420bec6 commit 7f384ef
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"SHENYU.HYSTRIX.TRIPPING.SLEEPTIME": "Sleep(ms)",
"SHENYU.HYSTRIX.MAX.CONCURRENCY": "MaxConcurrentRequests",
"SHENYU.HYSTRIX.ERROR.PERCENT": "ErrorThresholdPercentage",
"SHENYU.HYSTRIX.TIMEOUT": "Timeout(ms)",
"SHENYU.HYSTRIX.TRIPPING.REQUEST.NUMBER": "MinimumRequests",
"SHENYU.HYSTRIX.LSOLATION.MODE": "IsolationMode",
"SHENYU.HYSTRIX.LSOLATION.SELECT": "Select Quarantine Mode",
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"SHENYU.HYSTRIX.TRIPPING.SLEEPTIME": "跳闸休眠时间(ms)",
"SHENYU.HYSTRIX.MAX.CONCURRENCY": "最大并发量",
"SHENYU.HYSTRIX.ERROR.PERCENT": "错误百分比阀值",
"SHENYU.HYSTRIX.TIMEOUT": "超时时间(ms)",
"SHENYU.HYSTRIX.TRIPPING.REQUEST.NUMBER": "跳闸最小请求数量",
"SHENYU.HYSTRIX.LSOLATION.MODE": "隔离模式",
"SHENYU.HYSTRIX.LSOLATION.SELECT": "请选择隔离模式",
Expand Down
22 changes: 22 additions & 0 deletions src/routes/Plugin/PluginRuleHandle/HystrixRuleHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class HystrixRuleHandle extends Component {
errorThresholdPercentage = "50",
maxConcurrentRequests = "100",
sleepWindowInMilliseconds = "5000",
timeout = "3000",
groupKey = "",
commandKey = "",
callBackUri="",
Expand All @@ -52,6 +53,7 @@ export default class HystrixRuleHandle extends Component {
errorThresholdPercentage = myHandle.errorThresholdPercentage;
maxConcurrentRequests = myHandle.maxConcurrentRequests;
sleepWindowInMilliseconds = myHandle.sleepWindowInMilliseconds;
timeout = myHandle.timeout
groupKey = myHandle.groupKey;
commandKey = myHandle.commandKey;
if (typeof(myHandle.executionIsolationStrategy) !== 'undefined' ) {
Expand All @@ -67,6 +69,7 @@ export default class HystrixRuleHandle extends Component {
errorThresholdPercentage,
maxConcurrentRequests,
sleepWindowInMilliseconds,
timeout,
groupKey,
commandKey,
executionIsolationStrategy,
Expand All @@ -81,6 +84,7 @@ export default class HystrixRuleHandle extends Component {
errorThresholdPercentage,
maxConcurrentRequests,
sleepWindowInMilliseconds,
timeout,
groupKey,
commandKey,
executionIsolationStrategy,
Expand All @@ -95,13 +99,15 @@ export default class HystrixRuleHandle extends Component {
maxConcurrentRequests > 0 ? maxConcurrentRequests : "0";
const mySleepWindowInMilliseconds =
sleepWindowInMilliseconds > 0 ? sleepWindowInMilliseconds : "0";
const myTimeout = timeout>0?timeout:"3000"
const myCoreSize = hystrixThreadPoolConfig.coreSize > 0 ? hystrixThreadPoolConfig.coreSize : "0";
const myMaximumSize = hystrixThreadPoolConfig.maximumSize > 0 ? hystrixThreadPoolConfig.maximumSize : "0";
const myMaxQueueSize = hystrixThreadPoolConfig.maxQueueSize > 0 ? hystrixThreadPoolConfig.maxQueueSize : "0";
const handle = {
requestVolumeThreshold: myRequestVolumeThreshold,
errorThresholdPercentage: myErrorThresholdPercentage,
sleepWindowInMilliseconds: mySleepWindowInMilliseconds,
timeout:myTimeout,
executionIsolationStrategy,
callBackUri,
groupKey,
Expand Down Expand Up @@ -139,6 +145,7 @@ export default class HystrixRuleHandle extends Component {
errorThresholdPercentage,
maxConcurrentRequests,
sleepWindowInMilliseconds,
timeout,
groupKey,
commandKey,
executionIsolationStrategy,
Expand Down Expand Up @@ -213,6 +220,21 @@ export default class HystrixRuleHandle extends Component {
}}
/>
</li>
<li>
<Input
allowClear
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.TIMEOUT")}</div>}
value={timeout}
placeholder="timeout"
onChange={e => {
const value = e.target.value;
this.onHandleNumberChange(
"timeout",
value
);
}}
/>
</li>
{
this.state.executionIsolationStrategy === 1&&(
<li>
Expand Down

0 comments on commit 7f384ef

Please sign in to comment.