Merged
Conversation
Signed-off-by: Joas Schilling <coding@schilljs.com>
danxuliu
approved these changes
Jun 8, 2020
Member
danxuliu
left a comment
There was a problem hiding this comment.
Code makes sense 👍
Run the affected Talk integration tests (sharing/create.feature:722 and sharing/delete.feature:216) 20 times without failures.
Nice catch!
kesselb
reviewed
Jun 8, 2020
| $aTime = $a->getShareTime()->getTimestamp(); | ||
| $bTime = $b->getShareTime()->getTimestamp(); | ||
| if ($aTime === $bTime) { | ||
| return $a->getId() < $b->getId() ? -1 : 1; |
Contributor
There was a problem hiding this comment.
You could use spaceship here: https://stackoverflow.com/questions/30365346/what-is-the-spaceship-operator-in-php-7
Member
Author
|
/backport to stable19 |
Member
Author
|
Backporting to 19 so we have reliable tests there as well |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before the sorting wasn't really reliable.
In case you had 2 shares with the same timestamp, you could load them in 2 different orders.
This actually broke the talk integration tests in 90% of the time (when both shares have the same timestamp) while almost always working locally because the requests took a bit long and always working while debugging because then it always was longer than 1 second for me.
Now this makes sure that sorting is always done in the same way and in case of same timestamp it sorts by id.