Add Created status to JobStatus enum and store_job_in_redis_with_status method
This commit is contained in:
@@ -204,8 +204,8 @@ impl Client {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Store this job in Redis
|
||||
pub async fn store_job_in_redis(&self, job: &Job) -> Result<(), JobError> {
|
||||
/// Store this job in Redis with the specified status
|
||||
pub async fn store_job_in_redis_with_status(&self, job: &Job, status: JobStatus) -> Result<(), JobError> {
|
||||
let mut conn = self.redis_client
|
||||
.get_multiplexed_async_connection()
|
||||
.await
|
||||
@@ -220,7 +220,7 @@ impl Client {
|
||||
// Store job data in Redis hash
|
||||
let _: () = conn.hset_multiple(&job_key, &[
|
||||
("data", job_data),
|
||||
("status", JobStatus::Dispatched.as_str().to_string()),
|
||||
("status", status.as_str().to_string()),
|
||||
("created_at", job.created_at.to_rfc3339()),
|
||||
("updated_at", job.updated_at.to_rfc3339()),
|
||||
]).await
|
||||
@@ -232,6 +232,11 @@ impl Client {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Store this job in Redis (defaults to Dispatched status for backwards compatibility)
|
||||
pub async fn store_job_in_redis(&self, job: &Job) -> Result<(), JobError> {
|
||||
self.store_job_in_redis_with_status(job, JobStatus::Dispatched).await
|
||||
}
|
||||
|
||||
/// Load a job from Redis by ID
|
||||
pub async fn load_job_from_redis(
|
||||
|
||||
Reference in New Issue
Block a user