Extract and print out the time of the commit

Useful for visibility for when we inevitably fall behind in processing
This commit is contained in:
Aleksei Voronov 2023-10-02 16:59:31 +02:00
parent 6bc2dc2a42
commit 883d02e328
2 changed files with 5 additions and 2 deletions

View File

@ -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)

View File

@ -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<Utc>,
pub operations: Vec<Operation>,
}
@ -70,6 +72,7 @@ pub async fn handle_message<P: CommitProcessor>(message: &[u8], processor: &P) -
processor
.process_commit(&CommitDetails {
seq: commit.seq,
time: commit.time.parse()?,
operations,
})
.await?;