Use tokio::spawn instead of actix_rt::spawn

This commit is contained in:
silverpill 2022-07-17 00:00:35 +00:00
parent fd4d56c82b
commit dcb5736d74
5 changed files with 5 additions and 9 deletions

2
Cargo.lock generated
View file

@ -124,7 +124,6 @@ version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000"
dependencies = [
"actix-macros",
"futures-core",
"tokio",
]
@ -1592,7 +1591,6 @@ version = "0.8.0"
dependencies = [
"actix-cors",
"actix-files",
"actix-rt",
"actix-web",
"actix-web-httpauth",
"ammonia",

View file

@ -15,8 +15,6 @@ actix-cors = "0.6.1"
actix-files = "0.6.0"
actix-web = "4.0.1"
actix-web-httpauth = "0.6.0"
# Used for managing async tasks
actix-rt = "2.7.0"
# Used for HTML sanitization
ammonia = "3.2.0"
# Used for catching errors

View file

@ -121,7 +121,7 @@ pub struct OutgoingActivity<A: Serialize> {
pub recipients: Vec<Actor>,
}
impl<A: Serialize + 'static> OutgoingActivity<A> {
impl<A: Serialize + Send + 'static> OutgoingActivity<A> {
pub async fn deliver(self) -> Result<(), DelivererError> {
deliver_activity_worker(
self.instance,
@ -132,7 +132,7 @@ impl<A: Serialize + 'static> OutgoingActivity<A> {
}
pub fn spawn_deliver(self) -> () {
actix_rt::spawn(async move {
tokio::spawn(async move {
self.deliver().await.unwrap_or_else(|err| {
log::error!("{}", err);
});

View file

@ -30,7 +30,7 @@ pub async fn handle_delete(
};
let deletion_queue = delete_profile(db_client, &profile.id).await?;
let config = config.clone();
actix_rt::spawn(async move {
tokio::spawn(async move {
deletion_queue.process(&config).await;
});
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 config = config.clone();
actix_rt::spawn(async move {
tokio::spawn(async move {
deletion_queue.process(&config).await;
});
Ok(Some(NOTE))

View file

@ -161,7 +161,7 @@ async fn delete_status(
};
let deletion_queue = delete_post(db_client, &status_id).await?;
let config_clone = config.clone();
actix_rt::spawn(async move {
tokio::spawn(async move {
deletion_queue.process(&config_clone).await;
});