From 8daf39a1776563912de00a4a374a697ddcc6a316 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 19 May 2021 11:06:50 +0200 Subject: [PATCH 1/2] fixed cache issue do not evict the cache before get exams for institution otherwise connecting SEB clients will always reload all running exams form institution --- .../servicelayer/session/impl/ExamSessionServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index 67965c7b..abe8d6b1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -250,10 +250,8 @@ public class ExamSessionServiceImpl implements ExamSessionService { @Override public Result> getRunningExamsForInstitution(final Long institutionId) { - // NOTE: we evict the exam from the cache (if present) to ensure user is seeing always the current state of the Exam return this.examDAO.allIdsOfInstitution(institutionId) .map(col -> col.stream() - .map(this.examSessionCacheService::evict) .map(this::getRunningExam) .filter(Result::hasValue) .map(Result::get) From 2ac17108d67953bf636a54fdeb1d7a9e408b364f Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 19 May 2021 11:31:39 +0200 Subject: [PATCH 2/2] fixed caching issues evict only in distributed env --- .../session/impl/ExamJITSIProctoringService.java | 3 ++- .../servicelayer/session/impl/ExamSessionServiceImpl.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamJITSIProctoringService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamJITSIProctoringService.java index 63b21282..1d1fae40 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamJITSIProctoringService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamJITSIProctoringService.java @@ -321,7 +321,8 @@ public class ExamJITSIProctoringService implements ExamProctoringService { long expTime = System.currentTimeMillis() + Constants.DAY_IN_MILLIS; if (this.examSessionService.isExamRunning(examProctoring.examId)) { - final Exam exam = this.examSessionService.getRunningExam(examProctoring.examId) + final Exam exam = this.examSessionService + .getRunningExam(examProctoring.examId) .getOrThrow(); if (exam.endTime != null) { expTime = exam.endTime.getMillis(); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index abe8d6b1..ba1f822b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -227,7 +227,10 @@ public class ExamSessionServiceImpl implements ExamSessionService { log.trace("Running exam request for exam {}", examId); } - updateExamCache(examId); + if (this.distributedSetup) { + updateExamCache(examId); + } + final Exam exam = this.examSessionCacheService.getRunningExam(examId); if (this.examSessionCacheService.isRunning(exam)) {