Open Ryu945 opened 8 years ago
If you mean this is happening when sending messages - Discord uses snowflakes which is a distributed system which means order within couple tens milliseconds is not guaranteed.
See more here: https://github.com/twitter/snowflake/tree/b3f6a3c6ca8e1b6847baa6ff42bf72201e2c2231
We have a number of API resources that assume an ordering (they let you look things up "since this id").
However, as a result of a large number of asynchronous operations, we already don't guarantee in-order delivery.
We can guarantee, however, that the id numbers will be k-sorted (references: http://portal.acm.org/citation.cfm?id=70413.70419 and http://portal.acm.org/citation.cfm?id=110778.110783) within a reasonable bound (we're promising 1s, but shooting for 10's of ms).
Is there a way to fix it like put a required delay between every message sent to lower the probability/stop this from happening?
@Ryu945 if it's imperative it does not happen you could always manually add a setTimeout to your 2nd message or send it on the callback of the first message. These could both become harder to implement in a more complex system though.
Thanks for the information. I might have to add that. I posted here because I thought achieving correct message order in synchronus code was something the API would be interested in programming in.
Occasionally, the text que will get out of order. For example, out of 100 messages sent in a row, two neighbouring messages will be swapped with each other once. This happens consistently.