Skip to content

Commit

Permalink
trace logging to help see the consumer work
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-onelson committed Jul 9, 2024
1 parent 4cafbbc commit 5e2aaef
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bridge/svix-bridge/src/webhook_receiver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ async fn run_inner(poller: &SvixEventsPoller) -> ! {
subscription_id,
..
} = &poller.input_opts;

let mut iterator = None;
loop {
interval.tick().await;
Expand All @@ -278,6 +279,7 @@ async fn run_inner(poller: &SvixEventsPoller) -> ! {
.await
{
Ok(resp) => {
tracing::trace!("got messages, handling...");
for msg in resp.data.into_iter() {
let payload = match parse_payload(
&SerializablePayload::Standard(
Expand Down Expand Up @@ -311,10 +313,20 @@ async fn run_inner(poller: &SvixEventsPoller) -> ! {
);
}
}
tracing::trace!(
iterator =? &iterator,
next_iterator =? &resp.iterator,
"batch handled, updating local iterator"
);
// Update the iterator _after we've handled all the messages in the batch_.
iterator = Some(resp.iterator.clone());
}
Err(_) => {
Err(err) => {
tracing::trace!(
error =? err,
iterator =? &iterator,
"request failed, retrying current iterator"
);
tokio::time::sleep(ERROR_SLEEP).await;
}
}
Expand Down

0 comments on commit 5e2aaef

Please sign in to comment.