FIX: retry process block

This commit is contained in:
overtorment 2025-04-19 20:12:02 +01:00
parent 5d3f630a01
commit 1a8049ab0b
4 changed files with 11 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "groundcontrol",
"version": "3.0.0",
"version": "3.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {

View File

@ -1,6 +1,6 @@
{
"name": "groundcontrol",
"version": "3.0.0",
"version": "3.0.1",
"description": "GroundControl push server API",
"devDependencies": {
"@types/node": "18.7.16",

View File

@ -150,12 +150,17 @@ dataSource
continue;
}
const nextBlockToProcess = +keyVal.value + 1; // or +responseGetblockcount.result to aways process last block and skip intermediate blocks
let nextBlockToProcess: number = +keyVal.value + 1; // or +responseGetblockcount.result to aways process last block and skip intermediate blocks
const start = +new Date();
try {
await processBlock(nextBlockToProcess, sendQueueRepository);
} catch (error) {
console.warn("exception when processing block:", error, "continuing as usuall");
if (error.message.includes('socket hang up')) {
// issue fetching block from bitcoind
console.warn("retrying block number", nextBlockToProcess);
continue; // skip overwriting `LAST_PROCESSED_BLOCK` in `KeyValue` table
}
}
const end = +new Date();
console.log("took", (end - start) / 1000, "sec");

View File

@ -128,9 +128,9 @@ dataSource
console.warn('Exception in processMempool():', error);
}
const end = +new Date();
process.env.VERBOSE && console.log("processing mempool took", (end - start) / 1000, "sec");
process.env.VERBOSE && console.log("-----------------------");
await new Promise((resolve) => setTimeout(resolve, 3000, false));
console.log("processing mempool took", (end - start) / 1000, "sec");
console.log("-----------------------");
await new Promise((resolve) => setTimeout(resolve, 9000, false));
}
})
.catch((error) => {