From 175133f0cd648b8331fd7d4cd127eb2a2d0e9534 Mon Sep 17 00:00:00 2001 From: phiresky Date: Thu, 30 May 2024 12:52:24 +0200 Subject: [PATCH] comment about reverse ordering --- crates/federate/src/send.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/federate/src/send.rs b/crates/federate/src/send.rs index 46a612ef4..9658acf66 100644 --- a/crates/federate/src/send.rs +++ b/crates/federate/src/send.rs @@ -14,18 +14,19 @@ use std::ops::Deref; use tokio::{sync::mpsc::UnboundedSender, time::sleep}; use tokio_util::sync::CancellationToken; -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, Eq)] pub(crate) struct SendSuccessInfo { pub activity_id: ActivityId, pub published: Option>, pub was_skipped: bool, } -// order backwards by activity_id for the binary heap in the worker +/// order backwards by activity_id for the binary heap in the worker impl PartialEq for SendSuccessInfo { fn eq(&self, other: &Self) -> bool { self.activity_id == other.activity_id } } +/// order backwards because the binary heap is a max heap, and we need the smallest element to be on top impl PartialOrd for SendSuccessInfo { fn partial_cmp(&self, other: &Self) -> Option { other.activity_id.partial_cmp(&self.activity_id)