@Test public void errorTransitionDelayIsBetweenMinAndMaxDelay() { int maxDelay = 1_000_000; int minDelay = 1000; WorkflowSettings s = new WorkflowSettings.Builder().setMinErrorTransitionDelay(minDelay).setMaxErrorTransitionDelay(maxDelay).build(); long prevDelay = 0; for(int retryCount = 0 ; retryCount < 100 ; retryCount++) { long delay = s.getErrorTransitionActivation(retryCount).getMillis() - now.getMillis(); assertThat(delay, greaterThanOrEqualTo((long)minDelay)); assertThat(delay, lessThanOrEqualTo((long)maxDelay)); assertThat(delay, greaterThanOrEqualTo(prevDelay)); prevDelay = delay; } }
public DateTime getErrorTransitionActivation(int retryCount) { return now().plus(calculateBinaryBackoffDelay(retryCount + 1, minErrorTransitionDelay, maxErrorTransitionDelay)); }
WorkflowSettings extends ModelObject { public DateTime getErrorTransitionActivation(int retryCount) { return now().plus(calculateBinaryBackoffDelay(retryCount + 1, minErrorTransitionDelay, maxErrorTransitionDelay)); } }
WorkflowSettings extends ModelObject { public DateTime getErrorTransitionActivation(int retryCount) { return now().plus(calculateBinaryBackoffDelay(retryCount + 1, minErrorTransitionDelay, maxErrorTransitionDelay)); } WorkflowSettings(Builder builder); }
WorkflowSettings extends ModelObject { public DateTime getErrorTransitionActivation(int retryCount) { return now().plus(calculateBinaryBackoffDelay(retryCount + 1, minErrorTransitionDelay, maxErrorTransitionDelay)); } WorkflowSettings(Builder builder); DateTime getErrorTransitionActivation(int retryCount); DateTime getShortTransitionActivation(); int getMaxSubsequentStateExecutions(WorkflowState state); boolean deleteWorkflowInstanceHistory(); Short getDefaultPriority(); }
WorkflowSettings extends ModelObject { public DateTime getErrorTransitionActivation(int retryCount) { return now().plus(calculateBinaryBackoffDelay(retryCount + 1, minErrorTransitionDelay, maxErrorTransitionDelay)); } WorkflowSettings(Builder builder); DateTime getErrorTransitionActivation(int retryCount); DateTime getShortTransitionActivation(); int getMaxSubsequentStateExecutions(WorkflowState state); boolean deleteWorkflowInstanceHistory(); Short getDefaultPriority(); final int minErrorTransitionDelay; final int maxErrorTransitionDelay; final int shortTransitionDelay; final int immediateTransitionDelay; final int maxRetries; final int maxSubsequentStateExecutions; final Map<WorkflowState, Integer> maxSubsequentStateExecutionsPerState; final ReadablePeriod historyDeletableAfter; final BooleanSupplier deleteHistoryCondition; final short defaultPriority; }