Skip to content

Commit

Permalink
using const successFuture
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodolfo committed Jan 11, 2025
1 parent 120c0f4 commit b5f4815
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/kotlin/crablet/query/impl/SubscriptionComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ class SubscriptionComponent(
when (val eventSync = subscriptionConfig.eventSink) {
is EventSink.PostgresSingleEventSync -> {
jsonList
.fold(Future.succeededFuture<Void>()) { future, eventJson ->
.fold(successFuture) { future, eventJson ->
future.compose {
eventSync.handle(tx, eventJson)
}
}.map { jsonList }
}
is EventSink.SingleEventSink -> {
jsonList
.fold(Future.succeededFuture<Void>()) { future, eventJson ->
.fold(successFuture) { future, eventJson ->
future.compose {
eventSync.handle(eventJson)
}
Expand All @@ -67,6 +67,7 @@ class SubscriptionComponent(
}

companion object {
private val successFuture = Future.succeededFuture<Void>()
private const val SQL_UPDATE_OFFSET = "UPDATE subscriptions SET sequence_id = $2 where name = $1"
private const val SQL_EVENTS_QUERY = """
SELECT *
Expand Down

0 comments on commit b5f4815

Please sign in to comment.