Skip to content

Commit dbd8e6d

Browse files
committed
Fix MongoStepExecutionDao::getLastStepExecution
Closes GH-4896 Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
1 parent b0eccd2 commit dbd8e6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/mongodb/MongoStepExecutionDao.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
/**
3838
* @author Mahmoud Ben Hassine
39+
* @author Yanming Zhou
3940
* @since 5.2.0
4041
*/
4142
public class MongoStepExecutionDao implements StepExecutionDao {
@@ -114,7 +115,7 @@ public StepExecution getLastStepExecution(JobInstance jobInstance, String stepNa
114115
Optional<org.springframework.batch.core.repository.persistence.StepExecution> lastStepExecution = stepExecutions
115116
.stream()
116117
.filter(stepExecution -> stepExecution.getName().equals(stepName))
117-
.min(Comparator
118+
.max(Comparator
118119
.comparing(org.springframework.batch.core.repository.persistence.StepExecution::getCreateTime)
119120
.thenComparing(org.springframework.batch.core.repository.persistence.StepExecution::getId));
120121
if (lastStepExecution.isPresent()) {

0 commit comments

Comments
 (0)