Use tokio::spawn instead of actix_rt::spawn
This commit is contained in:
parent
fd4d56c82b
commit
dcb5736d74
5 changed files with 5 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -124,7 +124,6 @@ version = "2.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000"
|
checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-macros",
|
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
@ -1592,7 +1591,6 @@ version = "0.8.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-cors",
|
"actix-cors",
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-rt",
|
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-httpauth",
|
"actix-web-httpauth",
|
||||||
"ammonia",
|
"ammonia",
|
||||||
|
|
|
@ -15,8 +15,6 @@ actix-cors = "0.6.1"
|
||||||
actix-files = "0.6.0"
|
actix-files = "0.6.0"
|
||||||
actix-web = "4.0.1"
|
actix-web = "4.0.1"
|
||||||
actix-web-httpauth = "0.6.0"
|
actix-web-httpauth = "0.6.0"
|
||||||
# Used for managing async tasks
|
|
||||||
actix-rt = "2.7.0"
|
|
||||||
# Used for HTML sanitization
|
# Used for HTML sanitization
|
||||||
ammonia = "3.2.0"
|
ammonia = "3.2.0"
|
||||||
# Used for catching errors
|
# Used for catching errors
|
||||||
|
|
|
@ -121,7 +121,7 @@ pub struct OutgoingActivity<A: Serialize> {
|
||||||
pub recipients: Vec<Actor>,
|
pub recipients: Vec<Actor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: Serialize + 'static> OutgoingActivity<A> {
|
impl<A: Serialize + Send + 'static> OutgoingActivity<A> {
|
||||||
pub async fn deliver(self) -> Result<(), DelivererError> {
|
pub async fn deliver(self) -> Result<(), DelivererError> {
|
||||||
deliver_activity_worker(
|
deliver_activity_worker(
|
||||||
self.instance,
|
self.instance,
|
||||||
|
@ -132,7 +132,7 @@ impl<A: Serialize + 'static> OutgoingActivity<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_deliver(self) -> () {
|
pub fn spawn_deliver(self) -> () {
|
||||||
actix_rt::spawn(async move {
|
tokio::spawn(async move {
|
||||||
self.deliver().await.unwrap_or_else(|err| {
|
self.deliver().await.unwrap_or_else(|err| {
|
||||||
log::error!("{}", err);
|
log::error!("{}", err);
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub async fn handle_delete(
|
||||||
};
|
};
|
||||||
let deletion_queue = delete_profile(db_client, &profile.id).await?;
|
let deletion_queue = delete_profile(db_client, &profile.id).await?;
|
||||||
let config = config.clone();
|
let config = config.clone();
|
||||||
actix_rt::spawn(async move {
|
tokio::spawn(async move {
|
||||||
deletion_queue.process(&config).await;
|
deletion_queue.process(&config).await;
|
||||||
});
|
});
|
||||||
log::info!("deleted profile {}", profile.acct);
|
log::info!("deleted profile {}", profile.acct);
|
||||||
|
@ -48,7 +48,7 @@ pub async fn handle_delete(
|
||||||
};
|
};
|
||||||
let deletion_queue = delete_post(db_client, &post.id).await?;
|
let deletion_queue = delete_post(db_client, &post.id).await?;
|
||||||
let config = config.clone();
|
let config = config.clone();
|
||||||
actix_rt::spawn(async move {
|
tokio::spawn(async move {
|
||||||
deletion_queue.process(&config).await;
|
deletion_queue.process(&config).await;
|
||||||
});
|
});
|
||||||
Ok(Some(NOTE))
|
Ok(Some(NOTE))
|
||||||
|
|
|
@ -161,7 +161,7 @@ async fn delete_status(
|
||||||
};
|
};
|
||||||
let deletion_queue = delete_post(db_client, &status_id).await?;
|
let deletion_queue = delete_post(db_client, &status_id).await?;
|
||||||
let config_clone = config.clone();
|
let config_clone = config.clone();
|
||||||
actix_rt::spawn(async move {
|
tokio::spawn(async move {
|
||||||
deletion_queue.process(&config_clone).await;
|
deletion_queue.process(&config_clone).await;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue