mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 02:23:30 +00:00
Add logs
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user