Skip to content

Commit

Permalink
Closes #2377 - add configuration for lock expiration period
Browse files Browse the repository at this point in the history
  • Loading branch information
Jörg Heffner authored and gitgoodjhe committed Sep 25, 2023
1 parent 0565e59 commit 08ef4ca
Show file tree
Hide file tree
Showing 12 changed files with 332 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pro.taskana.TaskanaConfiguration;
import pro.taskana.common.api.ScheduledJob;
import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.api.TimeInterval;
Expand Down Expand Up @@ -52,6 +53,10 @@ public HistoryCleanupJob(
super(taskanaEngine, txProvider, scheduledJob, true);
}

public static Duration getLockExpirationPeriod(TaskanaConfiguration taskanaConfiguration) {
return taskanaConfiguration.getSimpleHistoryCleanupJobLockExpirationPeriod();
}

@Override
public void execute() {
Instant createdBefore = Instant.now().minus(minimumAge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,27 @@ void should_PopulateEveryTaskanaConfiguration_When_EveryBuilderFunctionIsCalled(
int expectedJobBatchSize = 50;
Instant expectedJobFirstJun = Instant.MIN;
Duration expectedJobRunEvery = Duration.ofDays(2);
Duration expectedJobLockExpirationPeriod = Duration.ofDays(2);
boolean expectedTaskCleanupJobEnabled = false;
Duration expectedTaskCleanupJobMinimumAge = Duration.ofDays(1);
boolean expectedTaskCleanupJobAllCompletedSameParentBusiness = false;
Duration expectedTaskCleanupJobLockExpirationPeriod = Duration.ofDays(2);
boolean expectedWorkbasketCleanupJobEnabled = false;
Duration expectedWorkbasketCleanupJobLockExpirationPeriod = Duration.ofDays(2);
boolean expectedSimpleHistoryCleanupJobEnabled = true;
int expectedSimpleHistoryCleanupJobBatchSize = 16;
Duration expectedSimpleHistoryCleanupJobMinimumAge = Duration.ofHours(3);
boolean expectedSimpleHistoryCleanupJobAllCompletedSameParentBusiness = false;
Duration expectedSimpleHistoryCleanupJobLockExpirationPeriod = Duration.ofDays(2);
boolean expectedTaskUpdatePriorityJobEnabled = true;
int expectedPriorityJobBatchSize = 49;
Instant expectedPriorityJobFirstRun = Instant.MIN.plus(1, ChronoUnit.DAYS);
Duration expectedTaskUpdatePriorityJobRunEvery = Duration.ofMinutes(17);
Duration expectedTaskUpdatePriorityJobLockExpirationPeriod = Duration.ofDays(2);
boolean expectedUserInfoRefreshJobEnabled = true;
Instant expectedUserRefreshJobFirstRun = Instant.MIN.plus(2, ChronoUnit.DAYS);
Duration expectedUserRefreshJobRunEvery = Duration.ofDays(5);
Duration expectedUserRefreshJobLockExpirationPeriod = Duration.ofDays(2);
Set<String> expectedJobSchedulerCustomJobs = Set.of("Job_A", "Job_B");
// user configuration
boolean expectedAddAdditionalUserInfo = true;
Expand Down Expand Up @@ -329,23 +335,32 @@ void should_PopulateEveryTaskanaConfiguration_When_EveryBuilderFunctionIsCalled(
.jobBatchSize(expectedJobBatchSize)
.jobFirstRun(expectedJobFirstJun)
.jobRunEvery(expectedJobRunEvery)
.jobLockExpirationPeriod(expectedJobLockExpirationPeriod)
.taskCleanupJobEnabled(expectedTaskCleanupJobEnabled)
.taskCleanupJobMinimumAge(expectedTaskCleanupJobMinimumAge)
.taskCleanupJobAllCompletedSameParentBusiness(
expectedTaskCleanupJobAllCompletedSameParentBusiness)
.taskCleanupJobLockExpirationPeriod(expectedTaskCleanupJobLockExpirationPeriod)
.workbasketCleanupJobEnabled(expectedWorkbasketCleanupJobEnabled)
.workbasketCleanupJobLockExpirationPeriod(
expectedWorkbasketCleanupJobLockExpirationPeriod)
.simpleHistoryCleanupJobEnabled(expectedSimpleHistoryCleanupJobEnabled)
.simpleHistoryCleanupJobBatchSize(expectedSimpleHistoryCleanupJobBatchSize)
.simpleHistoryCleanupJobMinimumAge(expectedSimpleHistoryCleanupJobMinimumAge)
.simpleHistoryCleanupJobAllCompletedSameParentBusiness(
expectedSimpleHistoryCleanupJobAllCompletedSameParentBusiness)
.simpleHistoryCleanupJobLockExpirationPeriod(
expectedSimpleHistoryCleanupJobLockExpirationPeriod)
.taskUpdatePriorityJobEnabled(expectedTaskUpdatePriorityJobEnabled)
.taskUpdatePriorityJobBatchSize(expectedPriorityJobBatchSize)
.taskUpdatePriorityJobFirstRun(expectedPriorityJobFirstRun)
.taskUpdatePriorityJobRunEvery(expectedTaskUpdatePriorityJobRunEvery)
.taskUpdatePriorityJobLockExpirationPeriod(
expectedTaskUpdatePriorityJobLockExpirationPeriod)
.userInfoRefreshJobEnabled(expectedUserInfoRefreshJobEnabled)
.userRefreshJobFirstRun(expectedUserRefreshJobFirstRun)
.userRefreshJobRunEvery(expectedUserRefreshJobRunEvery)
.userRefreshJobLockExpirationPeriod(expectedUserRefreshJobLockExpirationPeriod)
.customJobs(expectedJobSchedulerCustomJobs)
// user configuration
.addAdditionalUserInfo(expectedAddAdditionalUserInfo)
Expand Down Expand Up @@ -467,21 +482,27 @@ void should_PopulateEveryConfigurationProperty_When_UsingCopyConstructor() {
.jobBatchSize(50)
.jobFirstRun(Instant.MIN)
.jobRunEvery(Duration.ofDays(2))
.jobLockExpirationPeriod(Duration.ofDays(2))
.taskCleanupJobEnabled(false)
.taskCleanupJobMinimumAge(Duration.ofDays(1))
.taskCleanupJobAllCompletedSameParentBusiness(false)
.taskCleanupJobLockExpirationPeriod(Duration.ofDays(6))
.workbasketCleanupJobEnabled(false)
.workbasketCleanupJobLockExpirationPeriod(Duration.ofDays(7))
.simpleHistoryCleanupJobEnabled(true)
.simpleHistoryCleanupJobBatchSize(16)
.simpleHistoryCleanupJobMinimumAge(Duration.ofHours(3))
.simpleHistoryCleanupJobAllCompletedSameParentBusiness(false)
.simpleHistoryCleanupJobLockExpirationPeriod(Duration.ofDays(9))
.taskUpdatePriorityJobEnabled(true)
.taskUpdatePriorityJobBatchSize(49)
.taskUpdatePriorityJobFirstRun(Instant.MIN.plus(1, ChronoUnit.DAYS))
.taskUpdatePriorityJobRunEvery(Duration.ofMinutes(17))
.taskUpdatePriorityJobLockExpirationPeriod(Duration.ofDays(10))
.userInfoRefreshJobEnabled(true)
.userRefreshJobFirstRun(Instant.MIN.plus(2, ChronoUnit.DAYS))
.userRefreshJobRunEvery(Duration.ofDays(5))
.userRefreshJobLockExpirationPeriod(Duration.ofDays(8))
.customJobs(Set.of("Job_A", "Job_B"))
// user configuration
.addAdditionalUserInfo(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,27 @@ taskana.jobs.maxRetries=4
taskana.jobs.batchSize=50
taskana.jobs.firstRunAt=2018-07-25T08:00:00Z
taskana.jobs.runEvery=P2D
taskana.jobs.lockExpirationPeriod=PT7M
taskana.jobs.cleanup.task.enable=false
taskana.jobs.cleanup.task.minimumAge=P15D
taskana.jobs.cleanup.task.allCompletedSameParentBusiness=false
taskana.jobs.cleanup.task.lockExpirationPeriod=PT4M
taskana.jobs.cleanup.workbasket.enable=false
taskana.jobs.cleanup.workbasket.lockExpirationPeriod=PT3M
taskana.jobs.cleanup.history.simple.enable=true
taskana.jobs.cleanup.history.simple.batchSize=50
taskana.jobs.cleanup.history.simple.minimumAge=P17D
taskana.jobs.cleanup.history.simple.allCompletedSameParentBusiness=false
taskana.jobs.cleanup.history.simple.lockExpirationPeriod=PT2M
taskana.jobs.priority.task.enable=true
taskana.jobs.priority.task.batchSize=50
taskana.jobs.priority.task.firstRunAt=2018-07-25T08:00:00Z
taskana.jobs.priority.task.runEvery=P3D
taskana.jobs.priority.task.lockExpirationPeriod=PT8M
taskana.jobs.refresh.user.enable=true
taskana.jobs.refresh.user.firstRunAt=2018-07-25T08:00:00Z
taskana.jobs.refresh.user.runEvery=P4D
taskana.jobs.refresh.user.lockExpirationPeriod=PT5M
taskana.jobs.customJobs=A | B | C
# user configuration
taskana.user.addAdditionalUserInfo=true
Expand Down
Loading

0 comments on commit 08ef4ca

Please sign in to comment.