use of org.commonjava.indy.subsys.prefetch.models.RescanablePath in project indy by Commonjava.
the class PrefetchFrontier method rescheduleForRescan.
public void rescheduleForRescan() {
if (shouldSchedule && !hasMore) {
lockAnd(t -> {
for (RemoteRepository repo : repoQueue) {
if (repo.isPrefetchRescan()) {
String rescanTime = repo.getPrefetchRescanTimestamp();
logger.trace("repo's current rescan time: {}", rescanTime);
if (StringUtils.isBlank(rescanTime) || isNowAfter(rescanTime)) {
repo.setPrefetchRescanTimestamp(getNextRescanTimeFromNow(config.getRescanIntervalSeconds()));
try {
// Will not send store update event to avoid recursive rescheduling
storeDataManager.storeArtifactStore(repo, new ChangeSummary(ChangeSummary.SYSTEM_USER, "Update store for prefetch rescan update"), false, false, new EventMetadata());
} catch (IndyDataException e) {
logger.error(String.format("Can not update store in prefetching rescan for repo: %s", repo), e);
}
logger.trace("Rescan time set. Repo's next rescan time: {}", repo.getPrefetchRescanTimestamp());
final boolean isScheduledRescan = StringUtils.isNotBlank(rescanTime) && isNowAfter(rescanTime);
if (isScheduledRescan) {
List<RescanablePath> rootPaths = buildPaths(repo, true);
logger.trace("Schedule rescan enabled resources: repo: {}, paths {}", repo, rootPaths);
scheduleRepo(repo, rootPaths);
}
}
break;
}
}
return null;
});
}
}
Aggregations