WorkerConfig,
};
use lemmy_utils::{location_info, LemmyError};
-use reqwest::Client;
+use reqwest_middleware::ClientWithMiddleware;
use serde::{Deserialize, Serialize};
use std::{env, fmt::Debug, future::Future, pin::Pin};
use tracing::{info, warn};
actor: &dyn ActorType,
inboxes: Vec<&Url>,
activity: String,
- client: &Client,
+ client: &ClientWithMiddleware,
activity_queue: &QueueHandle,
) -> Result<(), LemmyError> {
for i in inboxes {
}
}
-async fn do_send(task: SendActivityTask, client: &Client) -> Result<(), Error> {
+async fn do_send(task: SendActivityTask, client: &ClientWithMiddleware) -> Result<(), Error> {
info!("Sending {} to {}", task.activity_id, task.inbox);
let result = sign_and_send(
client,
Ok(())
}
-pub fn create_activity_queue() -> Manager {
+pub fn create_activity_queue(client: ClientWithMiddleware) -> Manager {
// Configure and start our workers
- WorkerConfig::new_managed(Storage::new(), |_| MyState {
- client: Client::default(),
+ WorkerConfig::new_managed(Storage::new(), move |_| MyState {
+ client: client.clone(),
})
.register::<SendActivityTask>()
.start()
#[derive(Clone)]
struct MyState {
- pub client: Client,
+ pub client: ClientWithMiddleware,
}