forked from mirrors/relay
Merge branch 'main' of git.asonix.dog:asonix/relay into main
This commit is contained in:
commit
0d38133271
5 changed files with 46 additions and 59 deletions
81
Cargo.lock
generated
81
Cargo.lock
generated
|
@ -57,9 +57,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "actix-http"
|
||||
version = "3.0.0-beta.12"
|
||||
version = "3.0.0-beta.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afaeb3d3fcb06b775ac62f05d580aae4afe5a149513333a73f688fdf26c06639"
|
||||
checksum = "1bc3f9d97e32d75fae3ad7d955ac005eea3fd3ea60a89132768700911a60fd94"
|
||||
dependencies = [
|
||||
"actix-codec",
|
||||
"actix-rt",
|
||||
|
@ -187,9 +187,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "actix-web"
|
||||
version = "4.0.0-beta.11"
|
||||
version = "4.0.0-beta.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e85aa9bb018d83a0db70f557ba0cde9c6170a5d1de4fede02e377f68c1ac5aa9"
|
||||
checksum = "e87cfc4efaad42f8a054e269d1b85046397ff4e8707e49128dea3f99a512a9d6"
|
||||
dependencies = [
|
||||
"actix-codec",
|
||||
"actix-http",
|
||||
|
@ -392,9 +392,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
|||
|
||||
[[package]]
|
||||
name = "awc"
|
||||
version = "3.0.0-beta.10"
|
||||
version = "3.0.0-beta.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f122bed94dc044b13a991b292ff6a3cde4c3fba890a4e3dbbec0f2eedc607f0a"
|
||||
checksum = "f9f7d0c472987e454f41c3f4c7fa336ca139707ab255644b0480144c2060c800"
|
||||
dependencies = [
|
||||
"actix-codec",
|
||||
"actix-http",
|
||||
|
@ -458,9 +458,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "background-jobs-core"
|
||||
version = "0.11.0"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efad634cd0af64d5469cb30948b01e7b760b2c4eef278bd5a2d74a9aa123aa73"
|
||||
checksum = "174d36b170699ecc13b7513bda9eff6f12cc889eae5d16b792daa3f7b21be452"
|
||||
dependencies = [
|
||||
"actix-rt",
|
||||
"anyhow",
|
||||
|
@ -627,9 +627,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.2.1"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
|
||||
checksum = "3825b1e8580894917dc4468cb634a1b4e9745fddc854edad72d9c04644c0319f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
@ -803,9 +803,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca"
|
||||
checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -818,9 +818,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"
|
||||
checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
|
@ -828,15 +828,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"
|
||||
checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c"
|
||||
checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
|
@ -845,18 +845,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"
|
||||
checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"
|
||||
checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
|
@ -864,23 +862,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11"
|
||||
checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99"
|
||||
checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"
|
||||
checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
|
@ -890,8 +887,6 @@ dependencies = [
|
|||
"memchr",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"proc-macro-hack",
|
||||
"proc-macro-nested",
|
||||
"slab",
|
||||
]
|
||||
|
||||
|
@ -1735,18 +1730,6 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-nested"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.32"
|
||||
|
@ -2686,9 +2669,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-actix-web"
|
||||
version = "0.5.0-beta.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cac34827e06f78b69523b2fbe5b2dd4dfc75940b2ea5ba37e4fa2a25d4a0edf"
|
||||
version = "0.5.0-beta.3"
|
||||
source = "git+https://github.com/caizixian/tracing-actix-web#aafa35384335592718d8e7cf458a7de231d82843"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"pin-project",
|
||||
|
@ -2711,8 +2693,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "tracing-awc"
|
||||
version = "0.1.0-beta.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebd4b847e7dda81d94259935b8abcb7ddc7946ae99f11e4e6496cd32c237a304"
|
||||
source = "git+https://git.asonix.dog/asonix/tracing-awc#33aa802572c5b260835ae21f2df7f6528dfd07c5"
|
||||
dependencies = [
|
||||
"actix-http",
|
||||
"awc",
|
||||
|
|
|
@ -42,7 +42,7 @@ sled = "0.34.6"
|
|||
structopt = "0.3.12"
|
||||
thiserror = "1.0"
|
||||
tracing = "0.1"
|
||||
tracing-awc = "0.1.0-beta.7"
|
||||
tracing-awc = { version = "0.1.0-beta.7", git = "https://git.asonix.dog/asonix/tracing-awc" }
|
||||
tracing-error = "0.2"
|
||||
tracing-futures = "0.2"
|
||||
tracing-log = "0.1"
|
||||
|
@ -64,7 +64,8 @@ default-features = false
|
|||
features = ["client", "server", "sha-2"]
|
||||
|
||||
[dependencies.tracing-actix-web]
|
||||
version = "0.5.0-beta.1"
|
||||
version = "0.5.0-beta.2"
|
||||
git = "https://github.com/caizixian/tracing-actix-web"
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = "1.0"
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::{
|
|||
jobs::process_listeners::Listeners,
|
||||
requests::Requests,
|
||||
};
|
||||
use background_jobs::{memory_storage::Storage, Job, QueueHandle, WorkerConfig};
|
||||
use background_jobs::{memory_storage::Storage, Job, Manager, QueueHandle, WorkerConfig};
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) fn create_workers(
|
||||
|
@ -27,8 +27,8 @@ pub(crate) fn create_workers(
|
|||
actors: ActorCache,
|
||||
media: MediaCache,
|
||||
config: Config,
|
||||
) -> JobServer {
|
||||
let queue_handle = WorkerConfig::new(Storage::new(), move |queue_handle| {
|
||||
) -> (Manager, JobServer) {
|
||||
let shared = WorkerConfig::new_managed(Storage::new(), move |queue_handle| {
|
||||
JobState::new(
|
||||
state.clone(),
|
||||
actors.clone(),
|
||||
|
@ -52,9 +52,11 @@ pub(crate) fn create_workers(
|
|||
.set_worker_count("default", 16)
|
||||
.start();
|
||||
|
||||
queue_handle.every(Duration::from_secs(60 * 5), Listeners);
|
||||
shared.every(Duration::from_secs(60 * 5), Listeners);
|
||||
|
||||
JobServer::new(queue_handle)
|
||||
let job_server = JobServer::new(shared.queue_handle().clone());
|
||||
|
||||
(shared, job_server)
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -97,7 +97,8 @@ async fn main() -> Result<(), anyhow::Error> {
|
|||
let state = State::build(db.clone()).await?;
|
||||
let actors = ActorCache::new(db.clone());
|
||||
|
||||
let job_server = create_workers(state.clone(), actors.clone(), media.clone(), config.clone());
|
||||
let (manager, job_server) =
|
||||
create_workers(state.clone(), actors.clone(), media.clone(), config.clone());
|
||||
|
||||
let bind_address = config.bind_address();
|
||||
HttpServer::new(move || {
|
||||
|
@ -136,6 +137,8 @@ async fn main() -> Result<(), anyhow::Error> {
|
|||
.run()
|
||||
.await?;
|
||||
|
||||
drop(manager);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Resolver for RelayResolver {
|
|||
) -> LocalBoxFuture<'static, Result<Option<Webfinger>, Self::Error>> {
|
||||
let domain = domain.to_owned();
|
||||
let account = account.to_owned();
|
||||
let scheme = scheme.map(|s| s.to_owned());
|
||||
let scheme = scheme.map(|scheme| scheme.to_owned());
|
||||
|
||||
let fut = async move {
|
||||
if let Some(scheme) = scheme {
|
||||
|
|
Loading…
Reference in a new issue