diff --git a/src/repo.rs b/src/repo.rs index d324ba2..69d446c 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -303,7 +303,7 @@ impl JobId { #[async_trait::async_trait(?Send)] pub(crate) trait QueueRepo: BaseRepo { - async fn push(&self, queue: &'static str, job: Self::Bytes) -> Result<(), RepoError>; + async fn push(&self, queue: &'static str, job: Self::Bytes) -> Result; async fn pop(&self, queue: &'static str) -> Result<(JobId, Self::Bytes), RepoError>; @@ -317,7 +317,7 @@ impl QueueRepo for actix_web::web::Data where T: QueueRepo, { - async fn push(&self, queue: &'static str, job: Self::Bytes) -> Result<(), RepoError> { + async fn push(&self, queue: &'static str, job: Self::Bytes) -> Result { T::push(self, queue, job).await } diff --git a/src/repo/sled.rs b/src/repo/sled.rs index 6bb276e..986a75b 100644 --- a/src/repo/sled.rs +++ b/src/repo/sled.rs @@ -663,7 +663,7 @@ fn job_key(queue: &'static str, job_id: JobId) -> Arc<[u8]> { #[async_trait::async_trait(?Send)] impl QueueRepo for SledRepo { #[tracing::instrument(skip(self, job), fields(job = %String::from_utf8_lossy(&job)))] - async fn push(&self, queue_name: &'static str, job: Self::Bytes) -> Result<(), RepoError> { + async fn push(&self, queue_name: &'static str, job: Self::Bytes) -> Result { let metrics_guard = PushMetricsGuard::guard(queue_name); let id = JobId::gen(); @@ -692,7 +692,7 @@ impl QueueRepo for SledRepo { if let Some(notifier) = self.queue_notifier.read().unwrap().get(&queue_name) { notifier.notify_one(); metrics_guard.disarm(); - return Ok(()); + return Ok(id); } self.queue_notifier @@ -704,7 +704,7 @@ impl QueueRepo for SledRepo { metrics_guard.disarm(); - Ok(()) + Ok(id) } #[tracing::instrument(skip(self))]