Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/core/src/shared/utilities/resourceCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,24 @@ export abstract class CachedResource<V> {
const duration = now() - resource.timestamp
if (duration < this.expirationInMilli) {
logger.debug(
`cache hit, duration(%sms) is less than expiration(%sms), returning cached value %s`,
`cache hit, duration(%sms) is less than expiration(%sms), returning cached value: %s`,
duration,
this.expirationInMilli,
this.key
)
// release the lock
await this.releaseLock(resource, cachedValue)
return resource.result
} else {
logger.debug(
`cache is stale, duration(%sms) is older than expiration(%sms), pulling latest resource %s`,
duration,
this.expirationInMilli,
this.key
)
}

logger.debug(
`cache is stale, duration(%sms) is older than expiration(%sms), pulling latest resource: %s`,
duration,
this.expirationInMilli,
this.key
)
} else {
logger.info(`cache miss, pulling latest resource %s`, this.key)
logger.info(`cache miss, pulling latest resource: %s`, this.key)
}

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

const lock = await waitUntil(async () => {
const lock = await _acquireLock()
logger.debug(`try obtain resource cache read write lock for resource %s`, this.key)
logger.debug(`trying to acquire resource cache lock: %s`, this.key)
if (lock) {
return lock
}
Expand Down
Loading