@@ -61,12 +61,12 @@ pub trait BackgroundJob: Serialize + DeserializeOwned + Send + Sync + 'static {
6161 }
6262}
6363
64- fn enqueue_deduplicated (
64+ fn enqueue_deduplicated < ' a > (
6565 conn : & mut AsyncPgConnection ,
66- job_type : & ' static str ,
66+ job_type : & ' a str ,
6767 data : Value ,
6868 priority : i16 ,
69- ) -> impl Future < Output = Result < Option < i64 > , EnqueueError > > {
69+ ) -> BoxFuture < ' a , Result < Option < i64 > , EnqueueError > > {
7070 let similar_jobs = background_jobs:: table
7171 . select ( background_jobs:: id)
7272 . filter ( background_jobs:: job_type. eq ( job_type) )
@@ -92,15 +92,15 @@ fn enqueue_deduplicated(
9292 . returning ( background_jobs:: id)
9393 . get_result :: < i64 > ( conn) ;
9494
95- async move { Ok ( future. await . optional ( ) ?) }
95+ async move { Ok ( future. await . optional ( ) ?) } . boxed ( )
9696}
9797
98- fn enqueue_simple (
98+ fn enqueue_simple < ' a > (
9999 conn : & mut AsyncPgConnection ,
100- job_type : & ' static str ,
100+ job_type : & ' a str ,
101101 data : Value ,
102102 priority : i16 ,
103- ) -> impl Future < Output = Result < i64 , EnqueueError > > {
103+ ) -> BoxFuture < ' a , Result < i64 , EnqueueError > > {
104104 let future = diesel:: insert_into ( background_jobs:: table)
105105 . values ( (
106106 background_jobs:: job_type. eq ( job_type) ,
@@ -110,5 +110,5 @@ fn enqueue_simple(
110110 . returning ( background_jobs:: id)
111111 . get_result ( conn) ;
112112
113- async move { Ok ( future. await ?) }
113+ async move { Ok ( future. await ?) } . boxed ( )
114114}
0 commit comments