Skip to content

Commit

Permalink
Additional fetch logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Feb 13, 2024
1 parent 2bf037c commit 79ba2b2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ async function fetchMempoolFees() : Promise<MempoolFeeEstimates | null> {
}

const results = await Promise.allSettled(tasks);
logger.debug({ message: 'Fetched data from mempool: {results}', results });

let res0 = getValueFromFulfilledPromise(results[0]);
let res1 = getValueFromFulfilledPromise(results[1]);

Expand All @@ -182,7 +184,7 @@ async function fetchMempoolFees() : Promise<MempoolFeeEstimates | null> {
} else {
data = isRes1Invalid ? null : res1;
}
logger.debug({ message: 'Fetched data from mempool: {data}', data });
logger.info({ message: 'Got data from mempool: {data}', data });
return data;
}

Expand All @@ -198,11 +200,13 @@ async function fetchEsploraFees() : Promise<FeeByBlockTarget | null> {
return null;
}
const results = await Promise.allSettled(tasks);
logger.debug({ message: 'Fetched data from mempool: {results}', results });

let res0 = getValueFromFulfilledPromise(results[0]);
let res1 = getValueFromFulfilledPromise(results[1]);

const data: FeeByBlockTarget = res0 || res1 || null;
logger.debug({ message: 'Fetched data from esplora: {data}', data });
logger.info({ message: 'Got data from esplora: {data}', data });
return data;
}

Expand Down Expand Up @@ -257,7 +261,7 @@ async function fetchBitcoindFees() : Promise<FeeByBlockTarget | null> {
errors: response[i].result?.errors});
}
});
logger.debug({ message: 'Fetched data from bitcoind: {data}', data });
logger.info({ message: 'Got data from bitcoind: {data}', data });
resolve(data);
}
});
Expand Down

0 comments on commit 79ba2b2

Please sign in to comment.