@@ -175,63 +175,52 @@ impl<H: DurableExecution> Queue<H> {
175175 & self . name
176176 }
177177
178- /// Redis Cluster hash tag used to keep all queue keys in the same slot.
179- /// See: https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec/#hash-tags
180- fn redis_hash_tag ( & self ) -> String {
181- format ! ( "{{{}}}" , self . name( ) )
182- }
183-
184178 pub fn pending_list_name ( & self ) -> String {
185- format ! ( "twmq:{}:pending" , self . redis_hash_tag ( ) )
179+ format ! ( "twmq:{}:pending" , self . name ( ) )
186180 }
187181
188182 pub fn active_hash_name ( & self ) -> String {
189- format ! ( "twmq:{}:active" , self . redis_hash_tag ( ) )
183+ format ! ( "twmq:{}:active" , self . name )
190184 }
191185
192186 pub fn delayed_zset_name ( & self ) -> String {
193- format ! ( "twmq:{}:delayed" , self . redis_hash_tag ( ) )
187+ format ! ( "twmq:{}:delayed" , self . name )
194188 }
195189
196190 pub fn success_list_name ( & self ) -> String {
197- format ! ( "twmq:{}:success" , self . redis_hash_tag ( ) )
191+ format ! ( "twmq:{}:success" , self . name )
198192 }
199193
200194 pub fn failed_list_name ( & self ) -> String {
201- format ! ( "twmq:{}:failed" , self . redis_hash_tag ( ) )
195+ format ! ( "twmq:{}:failed" , self . name )
202196 }
203197
204198 pub fn job_data_hash_name ( & self ) -> String {
205- format ! ( "twmq:{}:jobs:data" , self . redis_hash_tag ( ) )
199+ format ! ( "twmq:{}:jobs:data" , self . name )
206200 }
207201
208202 pub fn job_meta_hash_name ( & self , job_id : & str ) -> String {
209- format ! ( "twmq:{}:job:{}:meta" , self . redis_hash_tag ( ) , job_id)
203+ format ! ( "twmq:{}:job:{}:meta" , self . name , job_id)
210204 }
211205
212206 pub fn job_errors_list_name ( & self , job_id : & str ) -> String {
213- format ! ( "twmq:{}:job:{}:errors" , self . redis_hash_tag ( ) , job_id)
207+ format ! ( "twmq:{}:job:{}:errors" , self . name , job_id)
214208 }
215209
216210 pub fn job_result_hash_name ( & self ) -> String {
217- format ! ( "twmq:{}:jobs:result" , self . redis_hash_tag ( ) )
211+ format ! ( "twmq:{}:jobs:result" , self . name )
218212 }
219213
220214 pub fn dedupe_set_name ( & self ) -> String {
221- format ! ( "twmq:{}:dedup" , self . redis_hash_tag ( ) )
215+ format ! ( "twmq:{}:dedup" , self . name )
222216 }
223217
224218 pub fn pending_cancellation_set_name ( & self ) -> String {
225- format ! ( "twmq:{}:pending_cancellations" , self . redis_hash_tag ( ) )
219+ format ! ( "twmq:{}:pending_cancellations" , self . name )
226220 }
227221
228222 pub fn lease_key_name ( & self , job_id : & str , lease_token : & str ) -> String {
229- format ! (
230- "twmq:{}:job:{}:lease:{}" ,
231- self . redis_hash_tag( ) ,
232- job_id,
233- lease_token
234- )
223+ format ! ( "twmq:{}:job:{}:lease:{}" , self . name, job_id, lease_token)
235224 }
236225
237226 pub async fn push (
@@ -312,8 +301,7 @@ impl<H: DurableExecution> Queue<H> {
312301 let position_string = delay. position . to_string ( ) ;
313302
314303 let _result: ( i32 , String ) = script
315- // Redis Cluster: all KEYS must be in the same slot
316- . key ( self . redis_hash_tag ( ) )
304+ . key ( & self . name )
317305 . key ( self . delayed_zset_name ( ) )
318306 . key ( self . pending_list_name ( ) )
319307 . key ( self . job_data_hash_name ( ) )
@@ -754,8 +742,7 @@ impl<H: DurableExecution> Queue<H> {
754742 Vec < String > ,
755743 Vec < String > ,
756744 ) = script
757- // Redis Cluster: all KEYS must be in the same slot
758- . key ( self . redis_hash_tag ( ) )
745+ . key ( self . name ( ) )
759746 . key ( self . delayed_zset_name ( ) )
760747 . key ( self . pending_list_name ( ) )
761748 . key ( self . active_hash_name ( ) )
@@ -1003,8 +990,7 @@ impl<H: DurableExecution> Queue<H> {
1003990 ) ;
1004991
1005992 let trimmed_count: usize = trim_script
1006- // Redis Cluster: all KEYS must be in the same slot
1007- . key ( self . redis_hash_tag ( ) )
993+ . key ( self . name ( ) )
1008994 . key ( self . success_list_name ( ) )
1009995 . key ( self . job_data_hash_name ( ) )
1010996 . key ( self . job_result_hash_name ( ) ) // results_hash
@@ -1182,8 +1168,7 @@ impl<H: DurableExecution> Queue<H> {
11821168 ) ;
11831169
11841170 let trimmed_count: usize = trim_script
1185- // Redis Cluster: all KEYS must be in the same slot
1186- . key ( self . redis_hash_tag ( ) )
1171+ . key ( self . name ( ) )
11871172 . key ( self . failed_list_name ( ) )
11881173 . key ( self . job_data_hash_name ( ) )
11891174 . key ( self . dedupe_set_name ( ) )
0 commit comments