diff --git a/CHANGELOG.md b/CHANGELOG.md index 03ba53a..36c1a62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Added `https://w3id.org/security/data-integrity/v1` to JSON-LD context. - Return `202 Accepted` when activity is accepted by inbox endpoint. - Ignore forwarded `Like` activities. +- Set 10 minute timeout on background job that processes incoming activities. ## [1.12.0] - 2023-01-26 diff --git a/src/job_queue/scheduler.rs b/src/job_queue/scheduler.rs index 078defd..5feef77 100644 --- a/src/job_queue/scheduler.rs +++ b/src/job_queue/scheduler.rs @@ -122,7 +122,12 @@ async fn incoming_activity_queue_task( db_pool: &DbPool, ) -> Result<(), Error> { let db_client = &mut **get_database_client(db_pool).await?; - process_queued_incoming_activities(config, db_client).await?; + let duration_max = Duration::from_secs(600); + let task_completed = process_queued_incoming_activities(config, db_client); + match tokio::time::timeout(duration_max, task_completed).await { + Ok(result) => result?, + Err(_) => log::error!("task timeout: IncomingActivityQueue"), + }; Ok(()) }