FIX: retry process block
This commit is contained in:
parent
5d3f630a01
commit
1a8049ab0b
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "groundcontrol",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user