Skip to content

Commit

Permalink
refactor: simplify offset update
Browse files Browse the repository at this point in the history
Co-authored-by: Christophe Camel <camel.christophe@gmail.com>
  • Loading branch information
amimart and ccamel committed Apr 8, 2022
1 parent b4da165 commit a6e4829
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/com/okp4/connect/cosmos/CosmosSourceTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class CosmosSourceTask : SourceTask() {
.toList()
}
}.also {
it.takeIf { it.isNotEmpty() }?.let { records ->
lastBlockHeightFromOffsetStorage = records[records.size - 1].sourceOffset()[HEIGHT_FIELD] as Long
it.lastOrNull()?.run {
lastBlockHeightFromOffsetStorage = sourceOffset()[HEIGHT_FIELD] as Long
}
}

Expand Down

0 comments on commit a6e4829

Please sign in to comment.