more resilience while query courses form several LMS. Make process

parallel and set circuit breaker to 10 seconds (request timeout is on 20
seconds)
This commit is contained in:
anhefti 2020-08-27 14:48:10 +02:00
parent cdf3b6d452
commit 5cfbf09d30
2 changed files with 3 additions and 3 deletions

View file

@ -36,14 +36,14 @@ public abstract class CourseAccess {
this.allQuizzesRequest = asyncService.createMemoizingCircuitBreaker( this.allQuizzesRequest = asyncService.createMemoizingCircuitBreaker(
allQuizzesSupplier(), allQuizzesSupplier(),
3, 3,
Constants.MINUTE_IN_MILLIS, 10 * Constants.SECOND_IN_MILLIS,
Constants.MINUTE_IN_MILLIS, Constants.MINUTE_IN_MILLIS,
true, true,
Constants.HOUR_IN_MILLIS); Constants.HOUR_IN_MILLIS);
this.chaptersRequest = asyncService.createCircuitBreaker( this.chaptersRequest = asyncService.createCircuitBreaker(
3, 3,
Constants.MINUTE_IN_MILLIS, 10 * Constants.SECOND_IN_MILLIS,
Constants.MINUTE_IN_MILLIS); Constants.MINUTE_IN_MILLIS);
} }

View file

@ -161,7 +161,7 @@ public class LmsAPIServiceImpl implements LmsAPIService {
final Long institutionId = filterMap.getInstitutionId(); final Long institutionId = filterMap.getInstitutionId();
return this.lmsSetupDAO.all(institutionId, true) return this.lmsSetupDAO.all(institutionId, true)
.getOrThrow() .getOrThrow()
.stream() .parallelStream()
.map(this::getLmsAPITemplate) .map(this::getLmsAPITemplate)
.flatMap(Result::onErrorLogAndSkip) .flatMap(Result::onErrorLogAndSkip)
.map(template -> template.getQuizzes(filterMap)) .map(template -> template.getQuizzes(filterMap))