Skip to content

Commit

Permalink
SEBSERV-474 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Oct 30, 2023
1 parent cf1a84a commit aff3544
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,16 @@ public Result<ClientConnection> save(final ClientConnection data) {
public Result<Boolean> saveSecurityCheckStatus(final Long connectionId, final Boolean checkStatus) {
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(
this.clientConnectionRecordMapper::update,
ClientConnectionRecordDynamicSqlSupport.clientConnectionRecord)
.set(ClientConnectionRecordDynamicSqlSupport.securityCheckGranted)
.equalTo(Utils.toByte(checkStatus))
.set(ClientConnectionRecordDynamicSqlSupport.updateTime)
.equalTo(nanosecondsNow)
.where(ClientConnectionRecordDynamicSqlSupport.id, isEqualTo(connectionId))
.build()
.execute();
Expand All @@ -442,13 +445,16 @@ public Result<Boolean> saveSecurityCheckStatus(final Long connectionId, final Bo
public Result<Boolean> saveSEBClientVersionCheckStatus(final Long connectionId, final Boolean checkStatus) {
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(
this.clientConnectionRecordMapper::update,
ClientConnectionRecordDynamicSqlSupport.clientConnectionRecord)
.set(ClientConnectionRecordDynamicSqlSupport.clientVersionGranted)
.equalTo(Utils.toByte(checkStatus))
.set(ClientConnectionRecordDynamicSqlSupport.updateTime)
.equalTo(nanosecondsNow)
.where(ClientConnectionRecordDynamicSqlSupport.id, isEqualTo(connectionId))
.build()
.execute();
Expand Down

0 comments on commit aff3544

Please sign in to comment.