@@ -68,24 +68,24 @@ export abstract class CachedResource<V> {
68
68
const duration = now ( ) - resource . timestamp
69
69
if ( duration < this . expirationInMilli ) {
70
70
logger . debug (
71
- `cache hit, duration(%sms) is less than expiration(%sms), returning cached value %s` ,
71
+ `cache hit, duration(%sms) is less than expiration(%sms), returning cached value: %s` ,
72
72
duration ,
73
73
this . expirationInMilli ,
74
74
this . key
75
75
)
76
76
// release the lock
77
77
await this . releaseLock ( resource , cachedValue )
78
78
return resource . result
79
- } else {
80
- logger . debug (
81
- `cache is stale, duration(%sms) is older than expiration(%sms), pulling latest resource %s` ,
82
- duration ,
83
- this . expirationInMilli ,
84
- this . key
85
- )
86
79
}
80
+
81
+ logger . debug (
82
+ `cache is stale, duration(%sms) is older than expiration(%sms), pulling latest resource: %s` ,
83
+ duration ,
84
+ this . expirationInMilli ,
85
+ this . key
86
+ )
87
87
} else {
88
- logger . info ( `cache miss, pulling latest resource %s` , this . key )
88
+ logger . info ( `cache miss, pulling latest resource: %s` , this . key )
89
89
}
90
90
91
91
/**
@@ -104,8 +104,8 @@ export abstract class CachedResource<V> {
104
104
timestamp : now ( ) ,
105
105
result : latest ,
106
106
}
107
- logger . info ( `doen loading latest resource, updating resource cache: %s` , this . key )
108
107
await this . releaseLock ( r )
108
+ logger . info ( `loaded latest resource and updated cache: %s` , this . key )
109
109
return latest
110
110
} catch ( e ) {
111
111
logger . error ( `failed to load latest resource, releasing lock: %s` , this . key )
@@ -129,7 +129,7 @@ export abstract class CachedResource<V> {
129
129
130
130
const lock = await waitUntil ( async ( ) => {
131
131
const lock = await _acquireLock ( )
132
- logger . debug ( `try obtain resource cache read write lock for resource %s` , this . key )
132
+ logger . debug ( `trying to acquire resource cache lock: %s` , this . key )
133
133
if ( lock ) {
134
134
return lock
135
135
}
0 commit comments