Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Keep track of last announce separately
cloudhead committed 1 year ago
commit a1c9a927c28539cc0435269c3fa8121956eb89f0
parent 484cf0220cca07cea1863d0e20d44827683da901
1 file changed +6 -2
modified radicle-node/src/service.rs
@@ -452,7 +452,9 @@ pub struct Service<D, S, G> {
    last_sync: LocalTime,
    /// Last time the service routing table was pruned.
    last_prune: LocalTime,
-
    /// Last time the inventory was announced.
+
    /// Last time the announcement task was run.
+
    last_announce: LocalTime,
+
    /// Timestamp of last local inventory announced.
    last_inventory: LocalTime,
    /// Last timestamp used for announcements.
    last_timestamp: Timestamp,
@@ -531,6 +533,7 @@ where
            last_sync: LocalTime::default(),
            last_prune: LocalTime::default(),
            last_timestamp,
+
            last_announce: LocalTime::default(),
            last_inventory: LocalTime::default(),
            started_at: None,     // Updated on initialize.
            last_online_at: None, // Updated on initialize.
@@ -827,11 +830,12 @@ where
            self.outbox.wakeup(SYNC_INTERVAL);
            self.last_sync = now;
        }
-
        if now - self.last_inventory >= ANNOUNCE_INTERVAL {
+
        if now - self.last_announce >= ANNOUNCE_INTERVAL {
            trace!(target: "service", "Running 'announce' task...");

            self.announce_inventory();
            self.outbox.wakeup(ANNOUNCE_INTERVAL);
+
            self.last_announce = now;
        }
        if now - self.last_prune >= PRUNE_INTERVAL {
            trace!(target: "service", "Running 'prune' task...");