Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
timedout
0f5ffd8676
fix: Helps when you refer to variables that exist 2026-03-09 16:43:09 +00:00
timedout
dbe024f645
feat: Add debug logs to pusher service 2026-03-09 16:37:51 +00:00
2 changed files with 31 additions and 5 deletions

View file

@ -1,4 +1,5 @@
use std::{ use std::{
env::args,
iter::once, iter::once,
sync::{ sync::{
Arc, OnceLock, Arc, OnceLock,
@ -18,7 +19,7 @@ use tokio::runtime::Builder;
use crate::{clap::Args, server::Server}; use crate::{clap::Args, server::Server};
const WORKER_NAME: &str = "conduwuit:worker"; const WORKER_NAME: &str = "c10y:worker";
const WORKER_MIN: usize = 2; const WORKER_MIN: usize = 2;
const WORKER_KEEPALIVE: u64 = 36; const WORKER_KEEPALIVE: u64 = 36;
const MAX_BLOCKING_THREADS: usize = 1024; const MAX_BLOCKING_THREADS: usize = 1024;

View file

@ -1,7 +1,7 @@
use std::{fmt::Debug, mem, sync::Arc}; use std::{fmt::Debug, mem, sync::Arc};
use bytes::BytesMut; use bytes::BytesMut;
use conduwuit::utils::response::LimitReadExt; use conduwuit::{debug, debug_info, utils::response::LimitReadExt};
use conduwuit_core::{ use conduwuit_core::{
Err, Event, Result, debug_warn, err, trace, Err, Event, Result, debug_warn, err, trace,
utils::{stream::TryIgnore, string_from_bytes}, utils::{stream::TryIgnore, string_from_bytes},
@ -220,7 +220,13 @@ impl Service {
} }
} }
let response = self.services.client.pusher.execute(reqwest_request).await; let response = self
.services
.client
.pusher
.execute(reqwest_request)
.await
.inspect(|r| debug!("Received response from push gateway {dest}: {r:?}"));
match response { match response {
| Ok(mut response) => { | Ok(mut response) => {
@ -490,9 +496,28 @@ impl Service {
.await .await
.ok(); .ok();
} }
debug_info!(
%url,
?notify,
?event,
"Sending notification to push gateway for {} in {}",
event.event_id(),
event.room_id_or_hash(),
);
self.send_request(&http.url, send_event_notification::v1::Request::new(notify)) self.send_request(&http.url, send_event_notification::v1::Request::new(notify))
.await?; .await
.inspect(|_| {
debug_info!(
"Successfully sent push notification for {}",
event.event_id()
)
})
.inspect_err(|e| {
debug_warn!(
"Failed to send push notification for {}: {e}",
event.event_id()
)
})?;
Ok(()) Ok(())
}, },