Summary
Console should sort events by time field
Why do we need this?
To give sensible log data to the users.
What is already there? What do you see now?
Seems that events are printed in the same order they arrive, which is not necessarily correct and confuses the user.

You can see, for example, join-request being accepted before it's received, which does not make sense.
What is missing? What do you want to see?
Events sorted by time in the console for clarity.
How do you propose to implement this?
Let A be the list of events presented in the console, let e be the event received.
If tail(A).time <= e.time, A = A ++ e, repeat with next e.
Otherwise, use binary search to find the index at which to insert e and do so. Note, it may be beneficial to only search over n last elements, where n<len(A), since in most cases, the insertion index i will be close to the tail.
Note(2), just looping in reverse order over A in order to find i is most probably also fine, however, once we start batching events and introduce more and more events, this may become problematic and using log(n) search algorithm may prove to be beneficial, it's also very straight-forward to implement. We could start with binary search over last 32 events perhaps and if not found, go to next "chunk" of events.
We should probably consider limiting the amount of events presented in the console as well, which can influence the choice of algorithm and it's parameters.
Can you do this yourself and submit a Pull Request?
I could, but I guess @bafonins is better suited for the job.
Summary
Console should sort events by
timefieldWhy do we need this?
To give sensible log data to the users.
What is already there? What do you see now?
Seems that events are printed in the same order they arrive, which is not necessarily correct and confuses the user.
What is missing? What do you want to see?
Events sorted by
timein the console for clarity.How do you propose to implement this?
Let
Abe the list of events presented in the console, letebe the event received.If
tail(A).time <= e.time,A = A ++ e, repeat with nexte.Otherwise, use binary search to find the index at which to insert
eand do so. Note, it may be beneficial to only search overnlast elements, wheren<len(A), since in most cases, the insertion indexiwill be close to the tail.Note(2), just looping in reverse order over
Ain order to findiis most probably also fine, however, once we start batching events and introduce more and more events, this may become problematic and usinglog(n)search algorithm may prove to be beneficial, it's also very straight-forward to implement. We could start with binary search over last 32 events perhaps and if not found, go to next "chunk" of events.We should probably consider limiting the amount of events presented in the console as well, which can influence the choice of algorithm and it's parameters.
Can you do this yourself and submit a Pull Request?
I could, but I guess @bafonins is better suited for the job.