Skip to content

Commit

Permalink
More idiomatic materializer
Browse files Browse the repository at this point in the history
  • Loading branch information
leviramsey committed Oct 30, 2024
1 parent 62d10cc commit 2f736c2
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ private[projection] class DynamoDBOffsetStore(
}

private def readTimestampOffset(): Future[TimestampOffsetBySlice] = {
implicit val sys = system // for implicit stream materializer
val oldState = state.get()
// retrieve latest timestamp for each slice, and use the earliest
val offsetBySliceFut =
Expand All @@ -263,7 +264,7 @@ private[projection] class DynamoDBOffsetStore(
.mapConcat(identity)
.runWith(Sink.fold(Map.empty[Int, TimestampOffset]) { (offsetMap, sliceAndOffset: (Int, TimestampOffset)) =>
offsetMap + sliceAndOffset
})(matFromSystem(system))
})

offsetBySliceFut.map { offsetBySlice =>
val newState = State(offsetBySlice)
Expand Down

0 comments on commit 2f736c2

Please sign in to comment.