From 775f98d968c9e044289f000f01e48eb604da8ba7 Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 30 Oct 2023 13:15:29 +0100 Subject: [PATCH] SEBSERV-474 fix --- .../dao/impl/ClientConnectionDAOImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java index ba0abd37..a5ced324 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java @@ -436,9 +436,14 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO { @Transactional public Result saveSecurityCheckStatus(final Long connectionId, final Boolean checkStatus) { return Result.tryCatch(() -> { + + // NOTE: we use nanoseconds here to get a better precision to better avoid + // same value of real concurrent calls on distributed systems + final long nanosecondsNow = System.nanoTime(); this.clientConnectionRecordMapper.updateByPrimaryKeySelective(new ClientConnectionRecord( connectionId, - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, nanosecondsNow, null, null, null, null, + null, Utils.toByte(checkStatus), null, null)); return checkStatus; @@ -450,9 +455,13 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO { @Transactional public Result saveSEBClientVersionCheckStatus(final Long connectionId, final Boolean checkStatus) { return Result.tryCatch(() -> { + // NOTE: we use nanoseconds here to get a better precision to better avoid + // same value of real concurrent calls on distributed systems + final long nanosecondsNow = System.nanoTime(); this.clientConnectionRecordMapper.updateByPrimaryKeySelective(new ClientConnectionRecord( connectionId, - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, nanosecondsNow, null, null, null, null, + null, null, null, Utils.toByte(checkStatus))); return checkStatus; })