Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ private Map<String, BrAPIGermplasm> fetchProgramGermplasm(UUID programId) throws
}
}

public void repopulateGermplasmCacheForProgram(UUID programId) {
programGermplasmCache.populate(programId);
}

/**
* Process germplasm into a format for display
* @param programGermplasm
Expand Down Expand Up @@ -310,11 +314,8 @@ public List<BrAPIGermplasm> createBrAPIGermplasm(List<BrAPIGermplasm> postBrAPIG
var program = programDAO.fetchOneById(programId);
try {
if (!postBrAPIGermplasmList.isEmpty()) {
Callable<Map<String, BrAPIGermplasm>> postFunction = () -> {
List<BrAPIGermplasm> postResponse = brAPIDAOUtil.post(postBrAPIGermplasmList, upload, api::germplasmPost, importDAO::update);
return processGermplasmForDisplay(postResponse, program.getKey());
};
return programGermplasmCache.post(programId, postFunction);
return new ArrayList<>(processGermplasmForDisplay(postResponse, program.getKey()).values());
}
return new ArrayList<>();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ public void postBrapiData(Map<Integer, PendingImport> mappedBrAPIImport, Program
try {
// Create germplasm list
brAPIListDAO.createBrAPILists(List.of(importList), program.getId(), upload);
// Now that we have finished uploading, fetch all the data posted to BrAPI to the cache so it is up-to-date.
brAPIGermplasmDAO.repopulateGermplasmCacheForProgram(program.getId());
} catch (ApiException e) {
throw new InternalServerException(e.toString(), e);
}
Expand Down
18 changes: 15 additions & 3 deletions src/main/resources/brapi/properties/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,25 @@ spring.datasource.password=${BRAPI_DB_PASSWORD}

spring.datasource.driver-class-name=org.postgresql.Driver

# This property when set to true makes it so that a DB transaction is open through the body of a request, nullifying the use of @Transactional.
# It is generally recommended that this be set to false, and methods are properly annotated and release the transactions when complete.
# However, many of the endpoints already rely on this kind of connection infrastructure and changing is more trouble than it's worth.
spring.jpa.open-in-view=true

spring.jpa.properties.hibernate.jdbc.batch_size=50
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true
spring.jpa.hibernate.ddl-auto=validate

# Use these to help debug queries.
# The stats will tell you how long hibernate transactions are taking, how many queries occur, how many entities are being flushed/accessed, etc.
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.generate_statistics=false

spring.flyway.locations=classpath:db/migration,classpath:db/sql,classpath:org/brapi/test/BrAPITestServer/db/migration
spring.flyway.schemas=public
spring.flyway.baselineOnMigrate=true

spring.jpa.hibernate.ddl-auto=validate
spring.jpa.show-sql=false

spring.mvc.dispatch-options-request=true

security.oidc_discovery_url=https://example.com/auth/.well-known/openid-configuration
Expand Down
Loading