From 5cfbf09d300df2d86324597ef1d236d0b923fec6 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 27 Aug 2020 14:48:10 +0200 Subject: [PATCH] more resilience while query courses form several LMS. Make process parallel and set circuit breaker to 10 seconds (request timeout is on 20 seconds) --- .../webservice/servicelayer/lms/impl/CourseAccess.java | 4 ++-- .../webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/CourseAccess.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/CourseAccess.java index 9af7d5ec..202a791c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/CourseAccess.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/CourseAccess.java @@ -36,14 +36,14 @@ public abstract class CourseAccess { this.allQuizzesRequest = asyncService.createMemoizingCircuitBreaker( allQuizzesSupplier(), 3, - Constants.MINUTE_IN_MILLIS, + 10 * Constants.SECOND_IN_MILLIS, Constants.MINUTE_IN_MILLIS, true, Constants.HOUR_IN_MILLIS); this.chaptersRequest = asyncService.createCircuitBreaker( 3, - Constants.MINUTE_IN_MILLIS, + 10 * Constants.SECOND_IN_MILLIS, Constants.MINUTE_IN_MILLIS); } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java index 3c83aa98..8ff61b55 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java @@ -161,7 +161,7 @@ public class LmsAPIServiceImpl implements LmsAPIService { final Long institutionId = filterMap.getInstitutionId(); return this.lmsSetupDAO.all(institutionId, true) .getOrThrow() - .stream() + .parallelStream() .map(this::getLmsAPITemplate) .flatMap(Result::onErrorLogAndSkip) .map(template -> template.getQuizzes(filterMap))