375d9a2a3c
* persistent activity queue * fixes * fixes * make federation workers function callable from outside * log federation instances * dead instance detection not needed here * taplo fmt * split federate bin/lib * minor fix * better logging * log * create struct to hold cancellable task for readability * use boxfuture for readability * reset submodule * fix * fix lint * swap * remove json column, use separate array columns instead * some review comments * make worker a struct for readability * minor readability * add local filter to community follower view * remove separate lemmy_federate entry point * fix remaining duration * address review comments mostly * fix lint * upgrade actitypub-fed to simpler interface * fix sql format * increase delays a bit * fixes after merge * remove selectable * fix instance selectable * add comment * start federation based on latest id at the time * rename federate process args * dead instances in one query * filter follow+report activities by local * remove synchronous federation remove activity sender queue * lint * fix federation tests by waiting for results to change * fix fed test * fix comment report * wait some more * Apply suggestions from code review Co-authored-by: SorteKanin <sortekanin@gmail.com> * fix most remaining tests * wait until private messages * fix community tests * fix community tests * move arg parse * use instance_id instead of domain in federation_queue_state table --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: SorteKanin <sortekanin@gmail.com>
52 lines
1.1 KiB
Rust
52 lines
1.1 KiB
Rust
#[macro_use]
|
|
extern crate strum_macros;
|
|
#[macro_use]
|
|
extern crate smart_default;
|
|
|
|
pub mod apub;
|
|
pub mod cache_header;
|
|
pub mod email;
|
|
pub mod rate_limit;
|
|
pub mod settings;
|
|
|
|
pub mod claims;
|
|
pub mod error;
|
|
pub mod request;
|
|
pub mod response;
|
|
pub mod utils;
|
|
pub mod version;
|
|
|
|
use error::LemmyError;
|
|
use futures::Future;
|
|
use std::time::Duration;
|
|
use tracing::Instrument;
|
|
|
|
pub type ConnectionId = usize;
|
|
|
|
pub const REQWEST_TIMEOUT: Duration = Duration::from_secs(10);
|
|
|
|
#[macro_export]
|
|
macro_rules! location_info {
|
|
() => {
|
|
format!(
|
|
"None value at {}:{}, column {}",
|
|
file!(),
|
|
line!(),
|
|
column!()
|
|
)
|
|
};
|
|
}
|
|
|
|
/// tokio::spawn, but accepts a future that may fail and also
|
|
/// * logs errors
|
|
/// * attaches the spawned task to the tracing span of the caller for better logging
|
|
pub fn spawn_try_task(task: impl Future<Output = Result<(), LemmyError>> + Send + 'static) {
|
|
tokio::spawn(
|
|
async {
|
|
if let Err(e) = task.await {
|
|
tracing::warn!("error in spawn: {e}");
|
|
}
|
|
}
|
|
.in_current_span(), // this makes sure the inner tracing gets the same context as where spawn was called
|
|
);
|
|
}
|