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

Use activity.replyToId as a hint for sorting #2991

Open
compulim opened this issue Mar 7, 2020 · 2 comments
Open

Use activity.replyToId as a hint for sorting #2991

compulim opened this issue Mar 7, 2020 · 2 comments
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. feature-request Azure report label

Comments

@compulim
Copy link
Contributor

compulim commented Mar 7, 2020

Feature Request

In addition of using activity.timestamp, we could also use activity.replyToId.

But also note that activity.id and activity.replyToId could be undefined/null.

Additional Context

This is not trivial to solve due to Direct Line protocol issue that is out of our control.

  • Bot activities are in random order due to distributed nature of the system
  • Although activity ID seems monotonic increasing, protocol team do not recommend us to use it for sorting, i.e. we can't use it
  • Thus, there are only 2 fields we can use for sorting: timestamp and replyToId

Currently, we are sorting based on timestamp. For incoming activities, we receive this timestamp field. For outgoing activities, we receive this timestamp field after the server successfully sent the activity. This also means, after the bot completely processed the activity.

As the system is distributed, outgoing activities may not receive "server-blessed" timestamp before the bot response. Thus, Web Chat need to use local clock for timestamp before receiving server-blessing.

We know there may be clock skew (especially when client set to wrong time zone).

Thus, in our previous PR, we attempted to measure/correct the clock skew between client and server. But it's not perfect since there could be milliseconds differences (bigger on mobile devices), user may see jitter of messages as recorded by @Slayouth.

Emulator works because the timestamp field is always local clock.

[Enhancement]

@compulim compulim added Enhancement customer-reported Required for internal Azure reporting. Do not delete. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. labels Mar 7, 2020
@compulim compulim changed the title Using activity.replyToId as a hint for sorting Use activity.replyToId as a hint for sorting Mar 7, 2020
@compulim compulim removed Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-reported Required for internal Azure reporting. Do not delete. labels Mar 7, 2020
@corinagum corinagum removed the Pending label Apr 3, 2020
@cwhitten cwhitten added the backlog Out of scope for the current iteration but it will be evaluated in a future release. label Sep 14, 2020
@corinagum corinagum added feature-request Azure report label and removed Enhancement labels Sep 23, 2020
@corinagum
Copy link
Contributor

Resolved by #3287

@corinagum corinagum reopened this Mar 9, 2021
@corinagum
Copy link
Contributor

reopening due to internal convo with @compulim :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. feature-request Azure report label
Projects
None yet
Development

No branches or pull requests

3 participants