diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java index b792fe8f..f72d3dc0 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java @@ -56,6 +56,7 @@ class ExamUpdateHandler { private final LmsAPIService lmsAPIService; private final String updatePrefix; private final Long examTimeSuffix; + private final boolean tryRecoverExam; public ExamUpdateHandler( final ExamDAO examDAO, @@ -63,7 +64,8 @@ class ExamUpdateHandler { final SEBRestrictionService sebRestrictionService, final LmsAPIService lmsAPIService, final WebserviceInfo webserviceInfo, - @Value("${sebserver.webservice.api.exam.time-suffix:3600000}") final Long examTimeSuffix) { + @Value("${sebserver.webservice.api.exam.time-suffix:3600000}") final Long examTimeSuffix, + @Value("${sebserver.webservice.api.exam.tryrecover:false}") final boolean tryRecoverExam) { this.examDAO = examDAO; this.applicationEventPublisher = applicationEventPublisher; @@ -72,6 +74,7 @@ class ExamUpdateHandler { this.updatePrefix = webserviceInfo.getLocalHostAddress() + "_" + webserviceInfo.getServerPort() + "_"; this.examTimeSuffix = examTimeSuffix; + this.tryRecoverExam = tryRecoverExam; } public SEBRestrictionService getSEBRestrictionService() { @@ -158,7 +161,7 @@ class ExamUpdateHandler { } }); - if (!failedOrMissing.isEmpty()) { + if (!failedOrMissing.isEmpty() && this.tryRecoverExam) { new HashSet<>(failedOrMissing).stream() .forEach(quizId -> tryRecoverQuizData(quizId, lmsSetupId, exams, updateId) .onSuccess(quizData -> failedOrMissing.remove(quizId)));