diff --git a/src/lib/api.ts b/src/lib/api.ts index 6488f19e6..61650432a 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -56,6 +56,7 @@ export const getPublishedContentByUrl = cache( // If the request is aborted, we don't need to make the API call // We call it as this logic is wrapped in an asynchronous cache that is not tied to the signal. + console.log('getPublishedContentByUrl', signal?.aborted); signal?.throwIfAborted(); const gitbook = new GitBookAPI({ diff --git a/src/lib/cache.ts b/src/lib/cache.ts index d37a731b8..eef9cc5e9 100644 --- a/src/lib/cache.ts +++ b/src/lib/cache.ts @@ -100,7 +100,9 @@ async function getCacheValue(key: string) { } if (redis) { + console.log('getCacheValue', key); const value = await wrapOperation(redis.get(key)); + console.log('done getCacheValue', key); return value; } @@ -114,11 +116,13 @@ async function setCacheValue(key: string, value: any, ttl: number) { memoryCache.set(key, value); if (redis) { + console.log('setCacheValue', key); await wrapOperation( redis.set(key, value, { ex: ttl, }), ); + console.log('done setCacheValue', key); } } diff --git a/src/middleware.ts b/src/middleware.ts index 5baf76a7a..103f2a704 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -241,6 +241,7 @@ async function lookupSpaceByAPI( Promise.all( lookupAlternatives.map(async (alternative) => { + console.log(`lookup content for url "${alternative.url}"`) const data = await getPublishedContentByUrl( alternative.url, apiEndpoint, @@ -254,6 +255,7 @@ async function lookupSpaceByAPI( return; } resolved = true; + console.log('aborting'); abort.abort(); if (alternative.url === url.toString()) {