mirror of
https://github.com/mikedilger/chorus.git
synced 2026-08-31 07:31:01 +00:00
Bugfix in event orering (BTreeSet would only keep one event with the same created_at)
This commit is contained in:
parent
9b0f293230
commit
38a20d0a78
@ -205,7 +205,9 @@ impl PartialOrd for Event<'_> {
|
||||
|
||||
impl Ord for Event<'_> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.created_at().cmp(&other.created_at())
|
||||
self.created_at()
|
||||
.cmp(&other.created_at())
|
||||
.then(self.id().cmp(&other.id()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::error::Error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Id(pub [u8; 32]);
|
||||
|
||||
impl Id {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user