feat: 2.6.0

1. 定时任务支持重试次数为0
This commit is contained in:
byteblogs168 2024-01-21 18:29:00 +08:00
parent 0440e127ca
commit 05d024bf11
3 changed files with 6 additions and 4 deletions

View File

@ -214,8 +214,8 @@ public class RpcClientInvokeHandler implements InvocationHandler {
private Retryer<Result> buildResultRetryer() { private Retryer<Result> buildResultRetryer() {
Retryer<Result> retryer = RetryerBuilder.<Result>newBuilder() Retryer<Result> retryer = RetryerBuilder.<Result>newBuilder()
.retryIfException(throwable -> failRetry) .retryIfException(throwable -> failRetry)
.withStopStrategy(StopStrategies.stopAfterAttempt(retryTimes)) .withStopStrategy(StopStrategies.stopAfterAttempt(retryTimes <= 0 ? 1 : retryTimes))
.withWaitStrategy(WaitStrategies.fixedWait(retryInterval, TimeUnit.SECONDS)) .withWaitStrategy(WaitStrategies.fixedWait(Math.max(retryInterval, 0), TimeUnit.SECONDS))
.withRetryListener(retryListener) .withRetryListener(retryListener)
.build(); .build();
return retryer; return retryer;

View File

@ -124,10 +124,12 @@ public class RequestClientActor extends AbstractActor {
} }
private JobRpcClient buildRpcClient(RegisterNodeInfo registerNodeInfo, RealJobExecutorDTO realJobExecutorDTO) { private JobRpcClient buildRpcClient(RegisterNodeInfo registerNodeInfo, RealJobExecutorDTO realJobExecutorDTO) {
int maxRetryTimes = realJobExecutorDTO.getMaxRetryTimes();
return RequestBuilder.<JobRpcClient, Result>newBuilder() return RequestBuilder.<JobRpcClient, Result>newBuilder()
.nodeInfo(registerNodeInfo) .nodeInfo(registerNodeInfo)
.namespaceId(registerNodeInfo.getNamespaceId()) .namespaceId(registerNodeInfo.getNamespaceId())
.failRetry(Boolean.TRUE) .failRetry(maxRetryTimes > 0)
.retryTimes(realJobExecutorDTO.getMaxRetryTimes()) .retryTimes(realJobExecutorDTO.getMaxRetryTimes())
.retryInterval(realJobExecutorDTO.getRetryInterval()) .retryInterval(realJobExecutorDTO.getRetryInterval())
.retryListener(new JobExecutorRetryListener(realJobExecutorDTO)) .retryListener(new JobExecutorRetryListener(realJobExecutorDTO))

View File

@ -210,7 +210,7 @@
<a-col :lg="6" :md="12" :sm="24"> <a-col :lg="6" :md="12" :sm="24">
<a-form-item label="最大重试次数"> <a-form-item label="最大重试次数">
<a-input-number <a-input-number
:min="1" :min="0"
v-decorator="[ v-decorator="[
'maxRetryTimes', 'maxRetryTimes',
{ {