Commit db44c6c 1 parent b9db3b5 commit db44c6c Copy full SHA for db44c6c
File tree 1 file changed +5
-5
lines changed
packages/bentocache/src/cache/facades
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,15 @@ export class RemoteCache {
38
38
* Try to execute a cache operation and fallback to a default value
39
39
* if the operation fails
40
40
*/
41
- async #tryCacheOperation< T > (
41
+ async #tryCacheOperation< T , K > (
42
42
operation : string ,
43
43
options : CacheEntryOptions ,
44
- fallbackValue : unknown ,
44
+ fallbackValue : K ,
45
45
fn : ( ) => T ,
46
- ) : Promise < T > {
46
+ ) : Promise < T | K > {
47
47
if ( this . #circuitBreaker?. isOpen ( ) ) {
48
48
this . #logger. error ( { opId : options . id } , `circuit breaker is open. ignoring operation` )
49
- return fallbackValue as any
49
+ return fallbackValue
50
50
}
51
51
52
52
try {
@@ -64,7 +64,7 @@ export class RemoteCache {
64
64
( is . undefined ( options . suppressL2Errors ) && this . #hasL1Backup) ||
65
65
options . suppressL2Errors
66
66
) {
67
- return fallbackValue as any
67
+ return fallbackValue
68
68
}
69
69
70
70
throw error
You can’t perform that action at this time.
0 commit comments