Skip to content

Commit

Permalink
bug handling batch commands
Browse files Browse the repository at this point in the history
  • Loading branch information
larousso committed Jul 18, 2024
1 parent c43f174 commit 94277b0
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ public CompletionStage<InTransactionResult<List<Either<Error, ProcessingSuccess<
.groupBy(env -> env._1)
.mapValues(l -> l.map(t -> t._2));
// for each original command, we prepare the result that we be returned
return indexedByCommandId.map(t -> {
CommandAndInfos<C, S, E, Message, Meta, Context> commandAndInfos = t._1;
List<EventEnvelope<E, Meta, Context>> eventEnvelopes = t._2;
return successes.map(commandAndInfos -> {
List<EventEnvelope<E, Meta, Context>> eventEnvelopes = indexedByCommandId.get(commandAndInfos).toList().flatMap(identity());
var mayBeLastSeqNum = eventEnvelopes.map(e -> e.sequenceNum).max();
return new CommandStateAndEvent(commandAndInfos.command, commandAndInfos.mayBeState, eventEnvelopes, commandAndInfos.events.events.toList(), commandAndInfos.events.message, mayBeLastSeqNum);
}).toList();
Expand Down Expand Up @@ -173,7 +172,7 @@ public CompletionStage<InTransactionResult<List<Either<Error, ProcessingSuccess<
sequences.max()
)
.thenApply(mayBeNextState ->
new ProcessingSuccess<>(s.state, mayBeNextState, s.getEventEnvelopes(), s.getMessage())
new ProcessingSuccess<>(s.getState(), mayBeNextState, s.getEventEnvelopes(), s.getMessage())
);
})
)
Expand Down

0 comments on commit 94277b0

Please sign in to comment.