Skip to content

Commit 50c5048

Browse files
committed
Merge remote-tracking branch 'origin/dev-1.2'
2 parents 2a38e74 + c3d5753 commit 50c5048

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<packaging>jar</packaging>
1717

1818
<properties>
19-
<seb-sps-version>1.2.1</seb-sps-version>
19+
<seb-sps-version>1.2.3_SNAPSHOT</seb-sps-version>
2020
<build-version>${seb-sps-version}</build-version>
2121
<revision>${seb-sps-version}</revision>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/ch/ethz/seb/sps/server/servicelayer/impl/ProctoringServiceImpl.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,22 @@ public void checkMonitoringSessionAccess(final String sessionUUID) {
112112
public synchronized Result<ScreenshotViewData> getRecordedImageDataAt(final String sessionUUID, final Long timestamp) {
113113
return Result.tryCatch(() -> {
114114

115-
boolean sessionActive = this.proctoringCacheService.getSession(sessionUUID).isActive();
115+
Session session = this.proctoringCacheService.getSession(sessionUUID);
116+
if (session == null) {
117+
log.warn("Failed to get Session for: {}", sessionUUID);
118+
throw new NoResourceFoundException(EntityType.SCREENSHOT_DATA, sessionUUID);
119+
}
120+
121+
// NOTE: if we have a distributed setup, refresh the cache to be sure we have the actual session from DB
122+
// TODO This is patch fix for SEBSP-217 and should be handled by overall session cache update for
123+
// distributed setup within the next release version
124+
if (isDistributedSetup) {
125+
proctoringCacheService.evictSession(sessionUUID);
126+
session = this.proctoringCacheService.getSession(sessionUUID);
127+
}
128+
129+
boolean sessionActive = session.isActive();
130+
116131

117132
if (timestamp == null) {
118133
// this means last timestamp and only should be called on live recording views

src/main/java/ch/ethz/seb/sps/server/servicelayer/impl/ScreenshotStore_S3.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,21 @@ public void storeScreenshot(
165165
}
166166

167167
private void processStore(final Collection<ScreenshotQueueData> batch) {
168-
batch.clear();
169-
this.screenshotDataQueue.drainTo(batch);
168+
try {
169+
batch.clear();
170+
this.screenshotDataQueue.drainTo(batch);
170171

171-
if (batch.isEmpty()) {
172-
return;
173-
}
172+
if (batch.isEmpty()) {
173+
return;
174+
}
174175

175-
if (batchStore) {
176-
applyBatchStore(batch);
177-
} else {
178-
applySingleStore(batch);
176+
if (batchStore) {
177+
applyBatchStore(batch);
178+
} else {
179+
applySingleStore(batch);
180+
}
181+
} catch (Exception e) {
182+
log.error("Failed to drain and process batch - should never happen: ", e);
179183
}
180184
}
181185

0 commit comments

Comments
 (0)