This commit is contained in:
parent
405028d078
commit
a90d76d209
2 changed files with 22 additions and 16 deletions
|
|
@ -49,23 +49,28 @@ public class UpdatingFidAndPdService {
|
||||||
Pipeline pipeline = pipelinePackageManager.buildRecalculationPD(new SetupParam(null, null, PipelineMode.RECALC_PERSONAL_DATA));
|
Pipeline pipeline = pipelinePackageManager.buildRecalculationPD(new SetupParam(null, null, PipelineMode.RECALC_PERSONAL_DATA));
|
||||||
CompletableFuture<?> future = pipelineRecalcPDOrchestrator.startOrReject(pipeline);
|
CompletableFuture<?> future = pipelineRecalcPDOrchestrator.startOrReject(pipeline);
|
||||||
future.whenComplete((o, throwable) -> {
|
future.whenComplete((o, throwable) -> {
|
||||||
if (throwable != null) {
|
try {
|
||||||
log.error(throwable.getMessage(), throwable);
|
if (throwable != null) {
|
||||||
return;
|
log.error(throwable.getMessage(), throwable);
|
||||||
}
|
return;
|
||||||
|
|
||||||
List<UserPackage> packagesRepeated = userPackageMapper.findForRepeatedPackages();
|
|
||||||
packagesRepeated.forEach(userPackage -> {
|
|
||||||
Long packageId = userPackage.getId();
|
|
||||||
SetupParam setupParam = new SetupParam(packageId, null, PipelineMode.DEFAULT);
|
|
||||||
try {
|
|
||||||
Pipeline makeXmlByCache = pipelinePackageManager.build(setupParam);
|
|
||||||
pipelinePackageOrchestrator.startOrDelay(makeXmlByCache, packageId);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Failed to build pipeline", e);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
List<UserPackage> packagesRepeated = userPackageMapper.findForRepeatedPackages();
|
||||||
|
packagesRepeated.forEach(userPackage -> {
|
||||||
|
Long packageId = userPackage.getId();
|
||||||
|
SetupParam setupParam = new SetupParam(packageId, null, PipelineMode.DEFAULT);
|
||||||
|
try {
|
||||||
|
Pipeline makeXmlByCache = pipelinePackageManager.build(setupParam);
|
||||||
|
pipelinePackageOrchestrator.startOrDelay(makeXmlByCache, packageId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to build pipeline", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
log.info("pipeline finished");
|
||||||
|
pipeline.close();
|
||||||
|
pipelineRecalcPDOrchestrator.release();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Failed to build pipeline", e);
|
log.error("Failed to build pipeline", e);
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,11 @@ public class PipelineRecalcPDOrchestrator {
|
||||||
.orTimeout(creditTrackerSettings.getPipeline().globalTimeout().toMillis(), TimeUnit.MILLISECONDS);
|
.orTimeout(creditTrackerSettings.getPipeline().globalTimeout().toMillis(), TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void release() {
|
public void release() {
|
||||||
log.debug("checking for delayed pipelines...");
|
log.debug("checking for delayed pipelines...");
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
|
log.info("semaphore amount: {}", semaphore.availablePermits());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue