From 10e7f9481f45d13040ffbe53c906bf677954b2a3 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Fri, 11 Oct 2024 16:16:05 +0200 Subject: [PATCH] worker: Inline `enqueue_with_priority()` fns We're not actually using this, so let's call YAGNI and remove it. --- crates/crates_io_worker/src/background_job.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/crates_io_worker/src/background_job.rs b/crates/crates_io_worker/src/background_job.rs index c8b5214ad8c..436bd05d01e 100644 --- a/crates/crates_io_worker/src/background_job.rs +++ b/crates/crates_io_worker/src/background_job.rs @@ -39,20 +39,13 @@ pub trait BackgroundJob: Serialize + DeserializeOwned + Send + Sync + 'static { /// Execute the task. This method should define its logic. fn run(&self, ctx: Self::Context) -> impl Future> + Send; - fn enqueue( - &self, - conn: &mut impl LoadConnection, - ) -> Result, EnqueueError> { - self.enqueue_with_priority(conn, Self::PRIORITY) - } - #[instrument(name = "swirl.enqueue", skip(self, conn), fields(message = Self::JOB_NAME))] - fn enqueue_with_priority( + fn enqueue( &self, conn: &mut impl LoadConnection, - priority: i16, ) -> Result, EnqueueError> { let data = serde_json::to_value(self)?; + let priority = Self::PRIORITY; if Self::DEDUPLICATED { Ok(enqueue_deduplicated(conn, Self::JOB_NAME, &data, priority)?)