use of org.springframework.scheduling.annotation.Scheduled in project mica2 by obiba.
the class TempFileService method cleanupTempFiles.
@Scheduled(fixedDelay = TEMP_FILE_CLEANUP_INTERVAL)
public void cleanupTempFiles() {
log.debug("Cleaning up tempfiles");
List<TempFile> tempFiles = tempFileRepository.findByCreatedDateLessThan(DateTime.now().minusHours(TEMP_FILE_EXPIRE_TIMEOUT), new PageRequest(0, 100));
tempFiles.forEach(f -> tempFileRepository.delete(f));
}
Aggregations