dotnetcore/CAP

Incorrect behavior when event is sent outside of transaction

NikolozGob opened this issue · 4 comments

We have encountered issues with using transaction and then sending an event. We were using Kafka with PostgreSQL. Issue can be replicated with Sample project.

Bug happens when we use database transaction and outside of transaction we send an event.

image

This causes event to be added in in Published table with Scheduled status and it's sent after 4 minutes instead of immediately, even if it is a delayed event.

For example, this event will be published in 4 minutes instead of one hour:
image

Bug cause:
Cap publisher is still holding transaction object, even though event is out of the scope of the transaction.

image

Hi @NikolozGob ,

Thanks for your report , It's a bug !

The code if (Transaction == null) should be if (Transaction?.DbTransaction == null) , would you want make a PR to fix it ?

Okay, I'll make a PR

Opened pull request

Fixed in version 8.1.2