fix: small bits

This commit is contained in:
nullishamy 2025-05-03 22:47:40 +01:00
parent ecb706e93f
commit f0e287c78d
Signed by: amy
SSH key fingerprint: SHA256:WmV0uk6WgAQvDJlM8Ld4mFPHZo02CLXXP5VkwQ5xtyk
3 changed files with 19 additions and 13 deletions

View file

@ -32,7 +32,7 @@ pub async fn handle_inbox_request(
) { ) {
match req { match req {
InboxRequest::Delete(_, _) => { InboxRequest::Delete(_, _) => {
todo!() warn!("unimplemented Delete");
}, },
InboxRequest::Follow { activity, followed, mut conn, outbound } => { InboxRequest::Follow { activity, followed, mut conn, outbound } => {
let kid = key_id(&followed); let kid = key_id(&followed);

View file

@ -46,22 +46,27 @@ impl RequestQueue {
let fut = async move { let fut = async move {
info!("using config {:#?}, queue is up", config); info!("using config {:#?}, queue is up", config);
let mut recv = self.recv; let mut recv = self.recv;
let http = HttpClient::new();
while let Some(req) = recv.recv().await { while let Some(req) = recv.recv().await {
info!(?req, "got a message into the queue"); info!(?req, "got a message into the queue");
match req { // Spawn up a new task so that we can run concurrently and also so we can not die if it panics
QueueMessage::Heartbeat => { tokio::spawn(async {
info!("heartbeat on queue"); let http = HttpClient::new();
},
QueueMessage::Inbound(inbox_request) => { match req {
handle_inbox_request(inbox_request, &http).await; QueueMessage::Heartbeat => {
}, info!("heartbeat on queue");
QueueMessage::Outbound(outbox_request) => { },
handle_outbox_request(outbox_request, &http).await; QueueMessage::Inbound(inbox_request) => {
}, handle_inbox_request(inbox_request, &http).await;
} },
QueueMessage::Outbound(outbox_request) => {
handle_outbox_request(outbox_request, &http).await;
},
}
});
} }
}.instrument(span); }.instrument(span);

View file

@ -143,6 +143,7 @@ pub async fn statuses(
FROM post p FROM post p
INNER JOIN user u on p.user_id = u.id INNER JOIN user u on p.user_id = u.id
WHERE u.id = ?1 WHERE u.id = ?1
ORDER BY p.created_at DESC
"#, uid) "#, uid)
.fetch_all(&mut **db) .fetch_all(&mut **db)
.await .await