···1-use std::sync::Arc;
2-use tokio_util::sync::CancellationToken;
3use crate::ClientMessage;
4use crate::error::ConsumerError;
5use crate::removable_delay_queue;
···8 events::{CommitOp, Cursor, EventKind},
9};
10use links::collect_links;
011use tokio::sync::broadcast;
01213const MAX_LINKS_PER_EVENT: usize = 100;
14···61 };
6263 // TODO: something a bit more robust
64- let at_uri = format!("at://{}/{}/{}", &*event.did, &*commit.collection, &*commit.rkey);
0006566 // TODO: keep a buffer and remove quick deletes to debounce notifs
67 // for now we just drop all deletes eek
68 if commit.operation == CommitOp::Delete {
69- d.remove_range((at_uri.clone(), 0)..=(at_uri.clone(), MAX_LINKS_PER_EVENT)).await;
070 continue;
71 }
72 let Some(ref record) = commit.record else {
···86 if i >= MAX_LINKS_PER_EVENT {
87 // todo: indicate if the link limit was reached (-> links omitted)
88 log::warn!("consumer: event has too many links, ignoring the rest");
89- metrics::counter!("consumer_dropped_links", "reason" => "too_many_links").increment(1);
090 break;
91 }
92 let client_message = match ClientMessage::new_link(link, &at_uri, commit) {
···94 Err(e) => {
95 // TODO indicate to clients that a link has been dropped
96 log::warn!("consumer: failed to serialize link to json: {e:?}");
97- metrics::counter!("consumer_dropped_links", "reason" => "failed_to_serialize").increment(1);
098 continue;
99 }
100 };
···001use crate::ClientMessage;
2use crate::error::ConsumerError;
3use crate::removable_delay_queue;
···6 events::{CommitOp, Cursor, EventKind},
7};
8use links::collect_links;
9+use std::sync::Arc;
10use tokio::sync::broadcast;
11+use tokio_util::sync::CancellationToken;
1213const MAX_LINKS_PER_EVENT: usize = 100;
14···61 };
6263 // TODO: something a bit more robust
64+ let at_uri = format!(
65+ "at://{}/{}/{}",
66+ &*event.did, &*commit.collection, &*commit.rkey
67+ );
6869 // TODO: keep a buffer and remove quick deletes to debounce notifs
70 // for now we just drop all deletes eek
71 if commit.operation == CommitOp::Delete {
72+ d.remove_range((at_uri.clone(), 0)..=(at_uri.clone(), MAX_LINKS_PER_EVENT))
73+ .await;
74 continue;
75 }
76 let Some(ref record) = commit.record else {
···90 if i >= MAX_LINKS_PER_EVENT {
91 // todo: indicate if the link limit was reached (-> links omitted)
92 log::warn!("consumer: event has too many links, ignoring the rest");
93+ metrics::counter!("consumer_dropped_links", "reason" => "too_many_links")
94+ .increment(1);
95 break;
96 }
97 let client_message = match ClientMessage::new_link(link, &at_uri, commit) {
···99 Err(e) => {
100 // TODO indicate to clients that a link has been dropped
101 log::warn!("consumer: failed to serialize link to json: {e:?}");
102+ metrics::counter!("consumer_dropped_links", "reason" => "failed_to_serialize")
103+ .increment(1);
104 continue;
105 }
106 };