Skip to content

Commit 3171de5

Browse files
authored
fix(resourcecache): improve logging #7175
1 parent f2eabbd commit 3171de5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/core/src/shared/utilities/resourceCache.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,24 @@ export abstract class CachedResource<V> {
6868
const duration = now() - resource.timestamp
6969
if (duration < this.expirationInMilli) {
7070
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`,
7272
duration,
7373
this.expirationInMilli,
7474
this.key
7575
)
7676
// release the lock
7777
await this.releaseLock(resource, cachedValue)
7878
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-
)
8679
}
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+
)
8787
} else {
88-
logger.info(`cache miss, pulling latest resource %s`, this.key)
88+
logger.info(`cache miss, pulling latest resource: %s`, this.key)
8989
}
9090

9191
/**
@@ -104,8 +104,8 @@ export abstract class CachedResource<V> {
104104
timestamp: now(),
105105
result: latest,
106106
}
107-
logger.info(`doen loading latest resource, updating resource cache: %s`, this.key)
108107
await this.releaseLock(r)
108+
logger.info(`loaded latest resource and updated cache: %s`, this.key)
109109
return latest
110110
} catch (e) {
111111
logger.error(`failed to load latest resource, releasing lock: %s`, this.key)
@@ -129,7 +129,7 @@ export abstract class CachedResource<V> {
129129

130130
const lock = await waitUntil(async () => {
131131
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)
133133
if (lock) {
134134
return lock
135135
}

0 commit comments

Comments
 (0)