File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
deepwell/src/services/job Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1919 */
2020
2121use super :: prelude:: * ;
22- use rsmq_async:: RsmqConnection ;
22+ use rsmq_async:: { Rsmq , RsmqConnection } ;
2323use std:: time:: Duration ;
2424
2525pub const JOB_QUEUE_NAME : & str = "job" ;
@@ -57,13 +57,19 @@ impl JobService {
5757 ctx : & ServiceContext < ' _ > ,
5858 job : & Job ,
5959 delay : Option < Duration > ,
60+ ) -> Result < ( ) > {
61+ let mut rsmq = ctx. rsmq ( ) ;
62+ Self :: queue_job_inner ( & mut rsmq, job, delay) . await
63+ }
64+
65+ pub async fn queue_job_inner (
66+ rsmq : & mut Rsmq ,
67+ job : & Job ,
68+ delay : Option < Duration > ,
6069 ) -> Result < ( ) > {
6170 info ! ( "Queuing job {job:?} (delay {delay:?})" ) ;
6271 let payload = serde_json:: to_vec ( job) ?;
63- ctx. rsmq ( )
64- . send_message ( JOB_QUEUE_NAME , payload, delay)
65- . await ?;
66-
72+ rsmq. send_message ( JOB_QUEUE_NAME , payload, delay) . await ?;
6773 Ok ( ( ) )
6874 }
6975
You can’t perform that action at this time.
0 commit comments