Skip to content

Commit 18f1e96

Browse files
committed
SEBSP-217 fixed bug within new code of last hot fix 1
1 parent 1d16671 commit 18f1e96

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/main/java/ch/ethz/seb/sps/server/datalayer/dao/impl/ScreenshotDataLiveCacheDAOBatis.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ public ScreenshotDataLiveCacheDAOBatis(
4545
@Transactional
4646
public Result<ScreenshotDataLiveCacheRecord> createCacheEntry(String sessionUUID) {
4747
return Result
48-
.tryCatch(() -> screenshotDataLiveCacheRecordMapper.selectByPrimaryKey(createSlot(sessionUUID)))
48+
.tryCatch(() -> {
49+
Long slotId = createSlot(sessionUUID);
50+
if (slotId == null) {
51+
throw new RuntimeException("Failed to get or create live cache slot for session: " + sessionUUID);
52+
}
53+
return screenshotDataLiveCacheRecordMapper.selectByPrimaryKey(slotId);
54+
})
4955
.onError(TransactionHandler::rollback);
5056
}
5157

@@ -114,7 +120,7 @@ private synchronized Long createSlot(String sessionUUID) {
114120

115121
ScreenshotDataLiveCacheRecord rec = existing.get(0);
116122
if (rec.getIdLatestSsd() != null) {
117-
return rec.getIdLatestSsd();
123+
return rec.getId();
118124
} else {
119125
// get value, update with value and return PK
120126
Long lastScreenshotEntryId = getLastScreenshotEntryId(sessionUUID);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public Long getLatestSSDataId(final String sessionUUID) {
129129
synchronized (this.cache) {
130130
screenshotDataLiveCacheDAO
131131
.createCacheEntry(sessionUUID)
132-
.onError(error -> log.error("Failed to create slot for session: {}", sessionUUID))
132+
.onError(error -> log.error("Failed to create slot for session: {}: error: {}", sessionUUID, error.getMessage()))
133133
.onSuccess(rec -> cache.put(sessionUUID, rec.getIdLatestSsd()));
134134
}
135135
}

0 commit comments

Comments
 (0)