Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watcher/scripts: reduce near batchsize #126

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion watcher/scripts/backfillNear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getMessagesFromBlockResults } from '../src/watchers/NearWatcher';
// Ensure `DB_SOURCE` and Bigtable environment variables are set to backfill Bigtable database.
// Otherwise, the script will backfill the local JSON database.

const BATCH_SIZE = 1000;
const BATCH_SIZE = 100;

(async () => {
const db = initDb();
Expand All @@ -25,10 +25,12 @@ const BATCH_SIZE = 1000;
const fromBlock = Number(
(await db.getLastBlockByChain(chain)) ?? INITIAL_DEPLOYMENT_BLOCK_BY_CHAIN[chain] ?? 0
);
// console.log(`Last block seen: ${fromBlock}`);

// fetch all transactions for core bridge contract from explorer
let log = ora('Fetching transactions from NEAR Explorer...').start();
const toBlock = await provider.block({ finality: 'final' });
// console.log('\ntoBlock', toBlock.header.height, toBlock.header.timestamp.toString());
const transactions = await getTransactionsByAccountId(
CONTRACTS.MAINNET.near.core,
BATCH_SIZE,
Expand Down