botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
66 stars 81 forks source link

Webchat messages order #1115

Closed BPMJoannette closed 3 years ago

BPMJoannette commented 3 years ago

Describe the bug Sometimes two consecutive messages have the same timestamp, and appear out of order image image

In this example, the greeting is supposed to come first, then the choice skill.

To Reproduce Conditions unknown. I attached an edited version of the embedded-webchat example which has the botId parameter built-in, and the proactive trigger necessary to have the bot start to interact with us. I could not reproduce using this setup.

  1. Create the welcome-bot from template
  2. Extract and drop the attached html file embed.html.zip in /data/assets/modules/channel-web/examples, open it in your browser.
  3. Open your browser developer console, and then the chat from the bubble.
  4. Parse the Network queries to find the one with the conversation messages, notice the timestamp for both messages.

Expected behavior Messages displayed in order

Screenshots If applicable, add screenshots to help explain your problem.

Environment:

Additional context Customer-raised issue.

slvnperron commented 3 years ago

@EFF the eventIds IMO should be guaranteed to be: 1) unique 2) temporal 3) incremental

so that we could sort messages by their IDs

With multiple servers running at the same time, that's a bit of a trick to achieve, but since the same incoming message is only processed by one server, it's safe to increment a local indice

EFF commented 3 years ago

More details on the cause of the issue here https://github.com/botpress/botpress/pull/4142