File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed
Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -770,15 +770,15 @@ export class Cacheable extends Hookified {
770770 }
771771 }
772772
773- const result = await this . deleteManyKeyv ( this . _primary , keys ) ;
773+ const result = await this . _primary . deleteMany ( keys ) ;
774774 if ( this . _secondary ) {
775775 if ( this . _nonBlocking ) {
776776 // Catch any errors to avoid unhandled promise rejections
777- this . deleteManyKeyv ( this . _secondary , keys ) . catch ( ( error ) => {
777+ this . _secondary . deleteMany ( keys ) . catch ( ( error ) => {
778778 this . emit ( CacheableEvents . ERROR , error ) ;
779779 } ) ;
780780 } else {
781- await this . deleteManyKeyv ( this . _secondary , keys ) ;
781+ await this . _secondary . deleteMany ( keys ) ;
782782 }
783783 }
784784
@@ -935,17 +935,6 @@ export class Cacheable extends Hookified {
935935 return result ;
936936 }
937937
938- private async deleteManyKeyv ( keyv : Keyv , keys : string [ ] ) : Promise < boolean > {
939- const promises = [ ] ;
940- for ( const key of keys ) {
941- promises . push ( keyv . delete ( key ) ) ;
942- }
943-
944- await Promise . all ( promises ) ;
945-
946- return true ;
947- }
948-
949938 private async setManyKeyv (
950939 keyv : Keyv ,
951940 items : CacheableItem [ ] ,
Original file line number Diff line number Diff line change @@ -1271,8 +1271,8 @@ describe("Non-blocking error handling", () => {
12711271 await primary . set ( "key1" , "value1" ) ;
12721272 await primary . set ( "key2" , "value2" ) ;
12731273
1274- // Make secondary.delete throw an error
1275- vi . spyOn ( secondary , "delete " ) . mockRejectedValue (
1274+ // Make secondary.deleteMany throw an error
1275+ vi . spyOn ( secondary , "deleteMany " ) . mockRejectedValue (
12761276 new Error ( "Secondary deleteMany error" ) ,
12771277 ) ;
12781278
You can’t perform that action at this time.
0 commit comments