SEBSERV-474 fix

This commit is contained in:
anhefti 2023-10-30 10:47:04 +01:00
parent cf1a84a38d
commit aff3544802

View file

@ -422,13 +422,16 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO {
public Result<Boolean> saveSecurityCheckStatus(final Long connectionId, final Boolean checkStatus) { public Result<Boolean> saveSecurityCheckStatus(final Long connectionId, final Boolean checkStatus) {
return Result.tryCatch(() -> { return Result.tryCatch(() -> {
// TODO fix update time update (SEBSERV-474) // 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();
UpdateDSL.updateWithMapper( UpdateDSL.updateWithMapper(
this.clientConnectionRecordMapper::update, this.clientConnectionRecordMapper::update,
ClientConnectionRecordDynamicSqlSupport.clientConnectionRecord) ClientConnectionRecordDynamicSqlSupport.clientConnectionRecord)
.set(ClientConnectionRecordDynamicSqlSupport.securityCheckGranted) .set(ClientConnectionRecordDynamicSqlSupport.securityCheckGranted)
.equalTo(Utils.toByte(checkStatus)) .equalTo(Utils.toByte(checkStatus))
.set(ClientConnectionRecordDynamicSqlSupport.updateTime)
.equalTo(nanosecondsNow)
.where(ClientConnectionRecordDynamicSqlSupport.id, isEqualTo(connectionId)) .where(ClientConnectionRecordDynamicSqlSupport.id, isEqualTo(connectionId))
.build() .build()
.execute(); .execute();
@ -442,13 +445,16 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO {
public Result<Boolean> saveSEBClientVersionCheckStatus(final Long connectionId, final Boolean checkStatus) { public Result<Boolean> saveSEBClientVersionCheckStatus(final Long connectionId, final Boolean checkStatus) {
return Result.tryCatch(() -> { return Result.tryCatch(() -> {
// TODO fix update time update (SEBSERV-474) // 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();
UpdateDSL.updateWithMapper( UpdateDSL.updateWithMapper(
this.clientConnectionRecordMapper::update, this.clientConnectionRecordMapper::update,
ClientConnectionRecordDynamicSqlSupport.clientConnectionRecord) ClientConnectionRecordDynamicSqlSupport.clientConnectionRecord)
.set(ClientConnectionRecordDynamicSqlSupport.clientVersionGranted) .set(ClientConnectionRecordDynamicSqlSupport.clientVersionGranted)
.equalTo(Utils.toByte(checkStatus)) .equalTo(Utils.toByte(checkStatus))
.set(ClientConnectionRecordDynamicSqlSupport.updateTime)
.equalTo(nanosecondsNow)
.where(ClientConnectionRecordDynamicSqlSupport.id, isEqualTo(connectionId)) .where(ClientConnectionRecordDynamicSqlSupport.id, isEqualTo(connectionId))
.build() .build()
.execute(); .execute();