Skip to content

Commit

Permalink
fails to start with many sources configured #2031
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-abushkevich committed May 11, 2022
1 parent 0985211 commit 5a3f575
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/org/ohdsi/webapi/service/CDMResultsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,13 @@ private void warmCaches(Collection<Source> sources) {
}

if (counter++ >= bucketSizes[bucketIndex] - 1) {
createJob(sourceIds.stream().map(String::valueOf).collect(Collectors.joining(", ")),
createJob(sourceIds.stream().map(String::valueOf).collect(Collectors.joining(",")),
String.join(", ", sourceKeys),
jobSteps);

bucketIndex++;
counter = 0;
sourceIds.clear();
sourceKeys.clear();
jobSteps.clear();
}
Expand Down Expand Up @@ -554,8 +555,15 @@ private String getWarmCacheJobName(String sourceKey) {
private String getWarmCacheJobName(String sourceIds, String sourceKeys) {
// for multiple sources: try to compose a job name from source keys, and if it is too long - use source ids
String jobName = String.format("warming cache: %s", sourceKeys);

if (jobName.length() >= 100) { // job name in batch_job_instance is varchar(100)
jobName = String.format("warming cache: %s", sourceIds);

if (jobName.length() >= 100) { // if we still have more than 100 symbols
jobName = jobName.substring(0, 88);
jobName = jobName.substring(0, jobName.lastIndexOf(','))
.concat(" and more..."); // todo: this is quick fix. need better solution
}
}
return jobName;
}
Expand Down

0 comments on commit 5a3f575

Please sign in to comment.