Skip to content

Commit

Permalink
fix: add break if block add fails
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPretorius committed Jun 4, 2024
1 parent a679c40 commit 9df7e3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/postgres/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const pool = new Pool({
// idleTimeoutMillis: 10000,
// number of milliseconds to wait before timing out when connecting a new client
// by default this is 0 which means no timeout
connectionTimeoutMillis: 1000,
connectionTimeoutMillis: 2000,
...(DATABASE_USE_SSL && { ssl: { rejectUnauthorized: false } }), // Use SSL (recommended
});

Expand Down
5 changes: 4 additions & 1 deletion src/sync/sync_blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ export const startSync = async () => {
// if already has synced, start from next block
if (currentBlock !== 1) currentBlock++;

// currentBlock = 2792944; // if need custom start block

if (logSync100Time) console.time("sync");
let count = 0;
while (syncing) {
// if (currentBlock === 2001) return;
// if (currentBlock === 2792945) return; // if need custom end block
// console.log("wait then get block:", currentBlock, getMemoryUsage().rss);
// await sleep(4000);
try {
Expand Down Expand Up @@ -83,6 +85,7 @@ export const startSync = async () => {
}
} catch (error) {
console.error(`ERROR::Adding Block ${currentBlock}:: ${error}`);
break;
}
}
};

0 comments on commit 9df7e3e

Please sign in to comment.