feat(sj_1.1.0): 优化客户端传递上下文
1. 优化分布式锁的重试间隔采用随机间隔 2.合并上下文重试采用随机间隔
This commit is contained in:
parent
364cfa8ee8
commit
1fb21cee5f
@ -13,7 +13,6 @@ import com.aizuda.snailjob.template.datasource.persistence.po.WorkflowTaskBatch;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Optional;
|
||||
@ -29,7 +28,6 @@ import java.util.Optional;
|
||||
public class WorkflowBatchGenerator {
|
||||
private final WorkflowTaskBatchMapper workflowTaskBatchMapper;
|
||||
|
||||
@Transactional
|
||||
public void generateJobTaskBatch(WorkflowTaskBatchGeneratorContext context) {
|
||||
|
||||
// 生成任务批次
|
||||
@ -53,7 +51,5 @@ public class WorkflowBatchGenerator {
|
||||
workflowTimerTaskDTO.setTaskExecutorScene(context.getTaskExecutorScene());
|
||||
|
||||
JobTimerWheel.registerWithWorkflow(() -> new WorkflowTimerTask(workflowTimerTaskDTO), Duration.ofMillis(delay));
|
||||
// JobTimerWheel.register(SyetemTaskTypeEnum.WORKFLOW.getType(), workflowTaskBatch.getId(),
|
||||
// new WorkflowTimerTask(workflowTimerTaskDTO), delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class DistributedLockHandler {
|
||||
Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder()
|
||||
.retryIfResult(result -> result.equals(Boolean.FALSE))
|
||||
.retryIfException(ex -> true)
|
||||
.withWaitStrategy(WaitStrategies.fixedWait(sleepTime.toMillis(), TimeUnit.MILLISECONDS))
|
||||
.withWaitStrategy(WaitStrategies.randomWait(sleepTime.toMillis(), TimeUnit.MILLISECONDS))
|
||||
.withStopStrategy(StopStrategies.stopAfterAttempt(maxRetryTimes))
|
||||
.withRetryListener(new RetryListener() {
|
||||
@Override
|
||||
|
@ -335,7 +335,7 @@ public class WorkflowBatchHandler {
|
||||
Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder()
|
||||
.retryIfResult(result -> result.equals(Boolean.FALSE))
|
||||
.retryIfException(ex -> true)
|
||||
.withWaitStrategy(WaitStrategies.fixedWait(500, TimeUnit.MILLISECONDS))
|
||||
.withWaitStrategy(WaitStrategies.randomWait(1000, TimeUnit.MILLISECONDS))
|
||||
// 重试3秒
|
||||
.withStopStrategy(StopStrategies.stopAfterAttempt(3))
|
||||
.withRetryListener(new RetryListener() {
|
||||
|
Loading…
Reference in New Issue
Block a user