Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BI-2450]BrAPI Server DB connections exhausted on biapi startup caching #444

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,12 @@ AWS_GENO_BUCKET=<s3 bucket for genotypic data uploads>
AWS_S3_ENDPOINT=<s3 endpoint, default https://s3.us-east-1.amazonaws.com>

BRAPI_VENDOR_SUBMISSION_ENABLED=false #can a submission be sent to a vendor via BrAPI
BRAPI_VENDOR_CHECK_FREQUENCY=1d #how often to check for vendor updates for sample submissions
BRAPI_VENDOR_CHECK_FREQUENCY=1d #how often to check for vendor updates for sample submissions

#The initial caching of each type of object needs to be staggered by the prescribed number of seconds
GERMPLASM_START_DELAY=5s
STUDY_START_DELAY=10s
TRIAL_START_DELAY=15s
TRAIT_START_DELAY=20s
OBSERVATION_START_DELAY=25s
OBSERVATION_UNIT_START_DELAY=30s
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public BrAPIGermplasmDAO(ProgramDAO programDAO, ImportDAO importDAO, BrAPIDAOUti
this.brAPIEndpointProvider = brAPIEndpointProvider;
}

@Scheduled(initialDelay = "2s")
@Scheduled(initialDelay = "${startup.delay.germplasm}")
public void setup() {
if(!runScheduledTasks) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public BrAPIObservationDAO(ProgramDAO programDAO,
this.programCache = programCacheProvider.getProgramCache(this::fetchProgramObservations, BrAPIObservation.class);
}

@Scheduled(initialDelay = "3s")
@Scheduled(initialDelay = "${startup.delay.observation}")
public void setup() {
if(!runScheduledTasks) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public BrAPIObservationUnitDAO(ProgramDAO programDAO,
this.programCache = programCacheProvider.getProgramCache(this::fetchProgramObservationUnits, BrAPIObservationUnit.class);
}

@Scheduled(initialDelay = "3s")
@Scheduled(initialDelay = "${startup.delay.observation_unit}")
public void setup() {
if(!runScheduledTasks) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public BrAPIStudyDAO(ProgramDAO programDAO, ImportDAO importDAO, BrAPIDAOUtil br
this.programCache = programCacheProvider.getProgramCache(this::fetchProgramStudy, BrAPIStudy.class);
}

@Scheduled(initialDelay = "2s")
@Scheduled(initialDelay = "${startup.delay.study}")
public void setup() {
if(!runScheduledTasks) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public BrAPITrialDAOImpl(ProgramCacheProvider programCacheProvider,
}


@Scheduled(initialDelay = "2s")
@Scheduled(initialDelay = "${startup.delay.trial}")
public void setup() {
if(!runScheduledTasks) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public TraitDAOImpl(Configuration config,
this.runScheduledTasks = runScheduledTasks;
}

@Scheduled(initialDelay = "2s")
@Scheduled(initialDelay = "${startup.delay.trait}")
public void setup() {
if(!runScheduledTasks) {
return;
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,11 @@ aws:
buckets:
genotype:
bucket: ${AWS_GENO_BUCKET}
startup:
delay:
germplasm: ${GERMPLASM_START_DELAY:2s}
study: ${STUDY_START_DELAY:2s}
trial: ${TRIAL_START_DELAY:2s}
trait: ${TRAIT_START_DELAY:2s}
observation: ${OBSERVATION_START_DELAY:3s}
observation_unit: ${OBSERVATION_UNIT_START_DELAY:3s}
Loading