forked from mirrors/relay
Remove actix actor dependency
This commit is contained in:
parent
a51bed3cc4
commit
d3e3a13997
6 changed files with 28 additions and 80 deletions
64
Cargo.lock
generated
64
Cargo.lock
generated
|
@ -26,31 +26,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix"
|
||||
version = "0.10.0-alpha.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54fb3bae2fcef0d8edbbf223ea187da5b6313e1bc6eb9494720b81bff9137d26"
|
||||
dependencies = [
|
||||
"actix-rt",
|
||||
"actix_derive",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"crossbeam-channel",
|
||||
"derive_more",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"parking_lot",
|
||||
"pin-project",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
"tokio-util 0.2.0",
|
||||
"trust-dns-proto",
|
||||
"trust-dns-resolver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix-codec"
|
||||
version = "0.2.0"
|
||||
|
@ -330,17 +305,6 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix_derive"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler32"
|
||||
version = "1.0.4"
|
||||
|
@ -480,11 +444,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "background-jobs-actix"
|
||||
version = "0.8.0-alpha.1"
|
||||
version = "0.8.0-alpha.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bb7f892dcd3ee34aab169d60587232d47aa054e4401c3067a64a6871eda806a"
|
||||
checksum = "d012b9293806c777f806b537e04b5eec34ecd6eaf876c52792017695ce53262f"
|
||||
dependencies = [
|
||||
"actix",
|
||||
"actix-rt",
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -502,11 +465,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "background-jobs-core"
|
||||
version = "0.8.0-alpha.1"
|
||||
version = "0.8.0-alpha.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa1b993ad1d58fd073cf19fac0d7bcc9772881e0568c59f011cd2aa513f587ab"
|
||||
checksum = "bd5efe91c019d7780d5a2fc2f92a15e1f95b84a761428e1d1972b7428634ebc7"
|
||||
dependencies = [
|
||||
"actix",
|
||||
"actix-rt",
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"chrono",
|
||||
|
@ -750,16 +713,6 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.2.1"
|
||||
|
@ -1453,12 +1406,6 @@ version = "0.1.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
|
||||
[[package]]
|
||||
name = "maybe-uninit"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
||||
|
||||
[[package]]
|
||||
name = "md5"
|
||||
version = "0.7.0"
|
||||
|
@ -1966,7 +1913,6 @@ name = "relay"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"activitystreams",
|
||||
"actix",
|
||||
"actix-rt",
|
||||
"actix-web",
|
||||
"actix-webfinger",
|
||||
|
|
|
@ -14,7 +14,6 @@ build = "src/build.rs"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
actix = "0.10.0-alpha.2"
|
||||
actix-rt = "1.0.0"
|
||||
actix-web = { version = "3.0.0-alpha.1", features = ["rustls"] }
|
||||
actix-webfinger = "0.3.0-alpha.6"
|
||||
|
|
|
@ -283,10 +283,10 @@ impl ActorCache {
|
|||
}
|
||||
|
||||
fn spawn_rehydrate(&self) {
|
||||
use actix::clock::{interval_at, Instant};
|
||||
use actix_rt::time::{interval_at, Instant};
|
||||
|
||||
let this = self.clone();
|
||||
actix::spawn(async move {
|
||||
actix_rt::spawn(async move {
|
||||
let mut interval = interval_at(Instant::now(), Duration::from_secs(60 * 10));
|
||||
|
||||
loop {
|
||||
|
|
|
@ -6,14 +6,17 @@ use crate::{
|
|||
requests::Requests,
|
||||
};
|
||||
use activitystreams::primitives::XsdAnyUri;
|
||||
use actix::clock::{interval_at, Duration, Instant};
|
||||
use actix_rt::{
|
||||
spawn,
|
||||
time::{interval_at, Instant},
|
||||
};
|
||||
use actix_web::web;
|
||||
use futures::{join, try_join};
|
||||
use log::{error, info};
|
||||
use lru::LruCache;
|
||||
use rand::thread_rng;
|
||||
use rsa::{RSAPrivateKey, RSAPublicKey};
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
use std::{collections::HashSet, sync::Arc, time::Duration};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -194,7 +197,7 @@ impl State {
|
|||
|
||||
fn spawn_rehydrate(&self, db: Db) {
|
||||
let state = self.clone();
|
||||
actix::spawn(async move {
|
||||
spawn(async move {
|
||||
let start = Instant::now();
|
||||
let duration = Duration::from_secs(60 * 10);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use actix::Arbiter;
|
||||
use actix_rt::Arbiter;
|
||||
use actix_web::{
|
||||
middleware::{Compress, Logger},
|
||||
web, App, HttpServer,
|
||||
|
|
|
@ -4,10 +4,10 @@ use crate::{
|
|||
jobs::{JobServer, QueryInstance, QueryNodeinfo},
|
||||
};
|
||||
use activitystreams::primitives::XsdAnyUri;
|
||||
use actix::clock::{delay_for, Duration};
|
||||
use actix_rt::{spawn, time::delay_for};
|
||||
use futures::stream::{poll_fn, StreamExt};
|
||||
use log::{debug, error, warn};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use std::{collections::HashMap, sync::Arc, time::Duration};
|
||||
use tokio_postgres::{tls::NoTls, AsyncMessage, Config};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
@ -43,7 +43,7 @@ impl Notifier {
|
|||
}
|
||||
|
||||
pub fn start(self) {
|
||||
actix::spawn(async move {
|
||||
spawn(async move {
|
||||
let Notifier { config, listeners } = self;
|
||||
|
||||
loop {
|
||||
|
@ -59,7 +59,7 @@ impl Notifier {
|
|||
let client = Arc::new(new_client);
|
||||
let new_client = client.clone();
|
||||
|
||||
actix::spawn(async move {
|
||||
spawn(async move {
|
||||
if let Err(e) = listen(&new_client).await {
|
||||
error!("Error listening for updates, {}", e);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ impl Listener for NewBlocks {
|
|||
debug!("Caching block of {}", payload);
|
||||
let state = self.0.clone();
|
||||
let payload = payload.to_owned();
|
||||
actix::spawn(async move { state.cache_block(payload).await });
|
||||
spawn(async move { state.cache_block(payload).await });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ impl Listener for NewWhitelists {
|
|||
debug!("Caching whitelist of {}", payload);
|
||||
let state = self.0.clone();
|
||||
let payload = payload.to_owned();
|
||||
actix::spawn(async move { state.cache_whitelist(payload.to_owned()).await });
|
||||
spawn(async move { state.cache_whitelist(payload.to_owned()).await });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ impl Listener for NewListeners {
|
|||
let state = self.0.clone();
|
||||
let _ = self.1.queue(QueryInstance::new(uri.clone()));
|
||||
let _ = self.1.queue(QueryNodeinfo::new(uri.clone()));
|
||||
actix::spawn(async move { state.cache_listener(uri).await });
|
||||
spawn(async move { state.cache_listener(uri).await });
|
||||
} else {
|
||||
warn!("Not caching listener {}, parse error", payload);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ impl Listener for NewActors {
|
|||
if let Ok(uri) = payload.parse::<XsdAnyUri>() {
|
||||
debug!("Caching actor {}", uri);
|
||||
let actors = self.0.clone();
|
||||
actix::spawn(async move { actors.cache_follower(uri).await });
|
||||
spawn(async move { actors.cache_follower(uri).await });
|
||||
} else {
|
||||
warn!("Not caching actor {}, parse error", payload);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ impl Listener for NewNodes {
|
|||
if let Ok(uuid) = payload.parse::<Uuid>() {
|
||||
debug!("Caching node {}", uuid);
|
||||
let nodes = self.0.clone();
|
||||
actix::spawn(async move { nodes.cache_by_id(uuid).await });
|
||||
spawn(async move { nodes.cache_by_id(uuid).await });
|
||||
} else {
|
||||
warn!("Not caching node {}, parse error", payload);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ impl Listener for RmBlocks {
|
|||
debug!("Busting block cache for {}", payload);
|
||||
let state = self.0.clone();
|
||||
let payload = payload.to_owned();
|
||||
actix::spawn(async move { state.bust_block(&payload).await });
|
||||
spawn(async move { state.bust_block(&payload).await });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ impl Listener for RmWhitelists {
|
|||
debug!("Busting whitelist cache for {}", payload);
|
||||
let state = self.0.clone();
|
||||
let payload = payload.to_owned();
|
||||
actix::spawn(async move { state.bust_whitelist(&payload).await });
|
||||
spawn(async move { state.bust_whitelist(&payload).await });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ impl Listener for RmListeners {
|
|||
if let Ok(uri) = payload.parse::<XsdAnyUri>() {
|
||||
debug!("Busting listener cache for {}", uri);
|
||||
let state = self.0.clone();
|
||||
actix::spawn(async move { state.bust_listener(&uri).await });
|
||||
spawn(async move { state.bust_listener(&uri).await });
|
||||
} else {
|
||||
warn!("Not busting listener cache for {}", payload);
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ impl Listener for RmActors {
|
|||
if let Ok(uri) = payload.parse::<XsdAnyUri>() {
|
||||
debug!("Busting actor cache for {}", uri);
|
||||
let actors = self.0.clone();
|
||||
actix::spawn(async move { actors.bust_follower(&uri).await });
|
||||
spawn(async move { actors.bust_follower(&uri).await });
|
||||
} else {
|
||||
warn!("Not busting actor cache for {}", payload);
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ impl Listener for RmNodes {
|
|||
if let Ok(uuid) = payload.parse::<Uuid>() {
|
||||
debug!("Caching node {}", uuid);
|
||||
let nodes = self.0.clone();
|
||||
actix::spawn(async move { nodes.bust_by_id(uuid).await });
|
||||
spawn(async move { nodes.bust_by_id(uuid).await });
|
||||
} else {
|
||||
warn!("Not caching node {}, parse error", payload);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue