File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,7 +114,17 @@ export async function deleteCache(...keys: string[]): Promise<void> {
114114
115115 const startTime = Date . now ( ) ;
116116 try {
117- await cache . del ( ...keys ) ;
117+ // In cluster mode, keys may hash to different slots
118+ // Use pipeline to delete individually (more efficient than separate awaits)
119+ if ( keys . length === 1 ) {
120+ await cache . del ( keys [ 0 ] ) ;
121+ } else {
122+ const pipeline = cache . pipeline ( ) ;
123+ for ( const key of keys ) {
124+ pipeline . del ( key ) ;
125+ }
126+ await pipeline . exec ( ) ;
127+ }
118128 const duration = Date . now ( ) - startTime ;
119129
120130 // Log cache operation with metrics (use first key as representative)
@@ -149,11 +159,15 @@ export async function deleteCachePattern(pattern: string): Promise<void> {
149159 }
150160
151161 if ( keys . length > 0 ) {
152- // Delete in batches to avoid overwhelming the cluster
162+ // Delete in batches using pipeline (cluster mode compatible)
153163 const batchSize = 100 ;
154164 for ( let i = 0 ; i < keys . length ; i += batchSize ) {
155165 const batch = keys . slice ( i , i + batchSize ) ;
156- await cache . del ( ...batch ) ;
166+ const pipeline = cache . pipeline ( ) ;
167+ for ( const key of batch ) {
168+ pipeline . del ( key ) ;
169+ }
170+ await pipeline . exec ( ) ;
157171 }
158172
159173 logger . info ( `Deleted cache keys matching pattern` , {
Original file line number Diff line number Diff line change 11// This file is automatically updated by semantic-release
2- export const VERSION = "1.8.0"
2+ export const VERSION = "1.8.0" ;
You can’t perform that action at this time.
0 commit comments