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

When implementing proactive messaging how can i ensure bot state is synchronized so bot state remains correct. #6592

Open
Rich-biomni opened this issue May 2, 2023 · 0 comments

Comments

@Rich-biomni
Copy link

When implementing proactive messaging how can i ensure bot state is synchronized so bot state remains correct.

In c#

When a message is received the botcontroller fires

await _adapter.ProcessAsync(Request, Response, _bot);

Middleware saves the current bot state including the dialog stack.

When a proactive message is received a different controller fires

await _adapter.ContinueConversationAsync(_appId, conversationReference, BotCallback);

The conversation continues, middleware again saves bot the current bot state including the dialog stack.

There seems to be a potential race condition where the bot code can be running for the same conversation / user at the same time and thus the saved bot state dialog stack ends up being last saved wins..

_adapter.ProcessAsync(Request, Response, _bot); --- starts captures the the bot state
...

   a proactive message is revived

   ContinueConversationAsync ...			          --- starts captures the bot state
								                  --- asks a question
								                  --- end of turn - saves bot state dialog stack

_adapter.ProcessAsync(Request, Response, _bot); --- completes
--- saves bot state - over writing the proactive state saved earlier

Ideally there's only one entry point where all bot messages are process in sequential queue.

Thanks

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

1 participant