Skip to content

Commit

Permalink
Fixed the duplicated fireEvent logs for the in-memory Baker. (#1653)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Linschoten authored Mar 21, 2024
1 parent 63f90bf commit 31a7b27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ case class RecipeInstance[F[_]](recipeInstanceId: String, config: RecipeInstance
} yield rejection
}
_ <- EitherT.liftF(components.eventStream.publish(EventReceived(currentTime, currentState.recipe.name, currentState.recipe.recipeId, recipeInstanceId, correlationId, input)))
_ <- EitherT.liftF(components.eventStream.publish(EventFired(currentTime, currentState.recipe.name, currentState.recipe.recipeId, recipeInstanceId, input)))
} yield baseCase(initialExecution)
.collect { case Some(output) => output.filterNot(config.ingredientsFilter) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ private[recipeinstance] case class TransitionExecution(
executeInteractionInstance(interactionTransition)
case _: EventTransition =>
for {
timerstamp <- timer.clock.realTime(MILLISECONDS)
_ <- effect.delay(components.logging.firingEvent(recipeInstanceId, "UNKNOWN", "UNKNOWN", id, transition, timerstamp))
endTime <- timer.clock.realTime(MILLISECONDS)
_ <- input match {
case Some(event) =>
val eventFired = EventFired(endTime, recipe.name, recipe.recipeId, recipeInstanceId, event)
components.logging.eventFired(eventFired)
components.eventStream.publish(eventFired)
case None => effect.unit
}
} yield input
case _ =>
effect.pure(None)
Expand Down Expand Up @@ -193,7 +199,7 @@ private[recipeinstance] case class TransitionExecution(
val eventFired = EventFired(endTime, recipe.name, recipe.recipeId, recipeInstanceId, event)
components.logging.eventFired(eventFired)
components.eventStream.publish(eventFired)
case None => effect.pure()
case None => effect.unit
}
} yield transformedOutput

Expand Down

0 comments on commit 31a7b27

Please sign in to comment.