From 883d02e3288890d3acf0ecf321743ba9ae203586 Mon Sep 17 00:00:00 2001 From: Aleksei Voronov Date: Mon, 2 Oct 2023 16:59:31 +0200 Subject: [PATCH] Extract and print out the time of the commit Useful for visibility for when we inevitably fall behind in processing --- src/processes/post_indexer.rs | 4 ++-- src/services/bluesky/streaming.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/processes/post_indexer.rs b/src/processes/post_indexer.rs index 40fc4a6..01871f2 100644 --- a/src/processes/post_indexer.rs +++ b/src/processes/post_indexer.rs @@ -103,8 +103,8 @@ impl CommitProcessor for PostIndexer { if commit.seq % 20 == 0 { info!( - "Updating cursor for {} to {}", - self.config.feed_generator_did, commit.seq + "Updating cursor for {} to {} ({})", + self.config.feed_generator_did, commit.seq, commit.time ); self.database .update_subscription_cursor(&self.config.feed_generator_did, commit.seq) diff --git a/src/services/bluesky/streaming.rs b/src/services/bluesky/streaming.rs index 8ba0084..d84e879 100644 --- a/src/services/bluesky/streaming.rs +++ b/src/services/bluesky/streaming.rs @@ -3,6 +3,7 @@ use std::collections::{HashMap, HashSet}; use anyhow::Result; use async_trait::async_trait; use atrium_api::com::atproto::sync::subscribe_repos::{Commit, Message}; +use chrono::{DateTime, Utc}; use super::{ decode::{read_record, FollowRecord, LikeRecord, PostRecord}, @@ -23,6 +24,7 @@ pub trait CommitProcessor { pub struct CommitDetails { pub seq: i32, + pub time: DateTime, pub operations: Vec, } @@ -70,6 +72,7 @@ pub async fn handle_message(message: &[u8], processor: &P) - processor .process_commit(&CommitDetails { seq: commit.seq, + time: commit.time.parse()?, operations, }) .await?;