Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waiting for an event in a while loop #1306

Open
paxhujing opened this issue Oct 11, 2024 · 2 comments
Open

Waiting for an event in a while loop #1306

paxhujing opened this issue Oct 11, 2024 · 2 comments

Comments

@paxhujing
Copy link

When you wait for an event in a while loop, you expect execution to continue each time the event is received and then continue waiting.

image

Why is context.ExecutionPointer.EventName null when CustomMessage.Run() executes, rather than the event name? context.ExecutionPointer.EventPublished Why is it false? Why don't loops wait?

image

@egyware
Copy link

egyware commented Jan 21, 2025

I have the same problem. Upon reviewing the data superficially, the event is not marked as consumed in the events table. It is possible that this is triggering the WaitFor repeatedly. In my case, I am using SQL Server.

Image

I don’t know if you resolved the issue, but I hope I can contribute to solving this problem.

@egyware
Copy link

egyware commented Jan 21, 2025

In the file WorkflowConsumer.cs, for some reason, after the event is successfully consumed and, in this case, the WaitFor is unlocked, the IsProcessed property is updated to True.

Then, for reasons I have yet to discover, the MarkEventUnprocessed function updates the IsProcessed property back to False. This causes the event to be re-enqueued and the WaitFor step in the workflow to be unlocked again.

I have been investigating this issue, but I still haven't identified the root cause of why MarkEventUnprocessed is being triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants