When implementing proactive messaging how can i ensure bot state is synchronized so bot state remains correct.
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
Hi @Rich-biomni
Do you still need assistance with this?