spring-batch
spring-batch copied to clipboard
Running a job causes retrieval of full history of job executions
trafficstars
When running a job via SimpleJobLauncher#run , it creates new JobExecution, but retrieves all executions of the job from database:
https://github.com/spring-projects/spring-batch/blob/f5041e6d7038bf4d34c627cfde1f21be4b0badbc/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java#L116
The approach to create new executions should be revised towards constant timing and constant memory usage regardless of how many times a job was executed in past.
My proposal would be to change a query to limit response size, e.g. last execution is enough to make a decision if running job instance exist.