I have a welcoming message configured to appear in MessagesController the first time my bot is started.
private Activity HandleSystemMessage(Activity message)
{
if (message.Type == ActivityTypes.ConversationUpdate)
{
// returning a msg here to the Post method in MessagesController.
}
}
When I debug it would seem that at start time, TWO threads are working the bot and both are executing in the Post method, and consequently both are calling HandleSystemMessage. This is a problem for me, because with two threads executing the method, my welcoming message is being printed twice on screen.
I tried locking the print msg and putting one of the threads to sleep, but none have worked. I don't know why there are two threads executing to begin with.
Are they necessary? they are both running an identical execution. Could I kill one of them? Or is there a different way to print a welcome message for the bot?