Skip to content

Commit

Permalink
Log delete success only when delete successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed Jun 17, 2024
1 parent 3a23293 commit d887420
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/ingestor/src/main/scala/ingestor.forum.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ object ForumIngestor:
private def deleteMany(events: List[ChangeStreamDocument[Document]]): IO[Unit] =
elastic
.deleteMany(index, events.flatMap(_.id.map(Id.apply)))
.flatTap(_ => info"Deleted ${events.size} forum posts")
.handleErrorWith: e =>
Logger[IO].error(e)(s"Failed to delete forum posts: ${events.map(_.id).mkString(", ")}")
*> info"Deleted ${events.size} forum posts"

private def saveLastIndexedTimestamp(time: Instant): IO[Unit] =
store.put(index.name, time.plusSeconds(1)) // +1 to avoid reindexing the same event
Expand Down

0 comments on commit d887420

Please sign in to comment.