Fixed purge external events job
This commit is contained in:
committed by
Arnold Gálovics
parent
7a9e696ac8
commit
77ee43acb8
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
@@ -30,6 +30,6 @@ public interface CommandSourceRepository extends JpaRepository<CommandSource, Lo
|
||||
|
||||
@Modifying(flushAutomatically = true)
|
||||
@Query("delete from CommandSource c where c.status = :status and c.madeOnDate is not null and c.madeOnDate <= :dateForPurgeCriteria")
|
||||
void deleteOlderEventsWithStatus(CommandProcessingResultType status, LocalDate dateForPurgeCriteria);
|
||||
void deleteOlderEventsWithStatus(Integer status, OffsetDateTime dateForPurgeCriteria);
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.jobs;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.commands.domain.CommandProcessingResultType;
|
||||
@@ -43,8 +43,8 @@ public class PurgeProcessedCommandsTasklet implements Tasklet {
|
||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
|
||||
try {
|
||||
Long numberOfDaysForPurgeCriteria = configurationDomainService.retrieveProcessedCommandsPurgeDaysCriteria();
|
||||
LocalDate dateForPurgeCriteria = DateUtils.getBusinessLocalDate().minusDays(numberOfDaysForPurgeCriteria);
|
||||
repository.deleteOlderEventsWithStatus(CommandProcessingResultType.PROCESSED, dateForPurgeCriteria);
|
||||
OffsetDateTime dateForPurgeCriteria = DateUtils.getOffsetDateTimeOfTenant().minusDays(numberOfDaysForPurgeCriteria);
|
||||
repository.deleteOlderEventsWithStatus(CommandProcessingResultType.PROCESSED.getValue(), dateForPurgeCriteria);
|
||||
} catch (Exception e) {
|
||||
log.error("Error occurred while purging processed commands: ", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user