use url::Url;
/// Max timeout for http requests
-const REQWEST_TIMEOUT: Duration = Duration::from_secs(10);
+pub(crate) const REQWEST_TIMEOUT: Duration = Duration::from_secs(10);
/// Placing the main function in lib.rs allows other crates to import it and embed Lemmy
pub async fn start_lemmy_server() -> Result<(), LemmyError> {
let pool = build_db_pool(&settings).await?;
run_advanced_migrations(&pool, &settings).await?;
- // Schedules various cleanup tasks for the DB
- thread::spawn(move || {
- scheduled_tasks::setup(db_url).expect("Couldn't set up scheduled_tasks");
- });
-
// Initialize the secrets
let secret = Secret::init(&pool)
.await
settings.bind, settings.port
);
+ let user_agent = build_user_agent(&settings);
let reqwest_client = Client::builder()
- .user_agent(build_user_agent(&settings))
+ .user_agent(user_agent.clone())
.timeout(REQWEST_TIMEOUT)
.build()?;
.with(TracingMiddleware::default())
.build();
+ // Schedules various cleanup tasks for the DB
+ thread::spawn(move || {
+ scheduled_tasks::setup(db_url, user_agent).expect("Couldn't set up scheduled_tasks");
+ });
+
let chat_server = Arc::new(ChatServer::startup());
// Create Http server with websocket support