Processing of location data points doesn't always take the same amount of time and sometimes, if two data points (from the same user) happen close to each other, the order may be reversed.
Inserting a sleep(500) seems enough to make the order correct.
An await(...) isn't always sufficient as the await() could finish too quickly.
Testing wise ... for some reason, this happens on circleci but doesn't happen on my local machine. On CircleCI, on this branch, it happens about 50% of the time. After the change in this PR, I ran the tests 10 times and it didn't happen once.
My theory is as follows:
Processing of location data points doesn't always take the same amount of time and sometimes, if two data points (from the same user) happen close to each other, the order may be reversed.
Inserting a
sleep(500)
seems enough to make the order correct.An
await(...)
isn't always sufficient as the await() could finish too quickly.Testing wise ... for some reason, this happens on circleci but doesn't happen on my local machine. On CircleCI, on this branch, it happens about 50% of the time. After the change in this PR, I ran the tests 10 times and it didn't happen once.