Skip to content

Commit

Permalink
Change subsquid processor file writer frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-snx committed Nov 22, 2024
1 parent af6b1d5 commit 23c7237
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions indexers/patches/@subsquid+squid-gen-evm+1.2.1.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
diff --git a/node_modules/@subsquid/squid-gen-evm/lib/core.js b/node_modules/@subsquid/squid-gen-evm/lib/core.js
index 2839b6f..902f4eb 100644
index 2839b6f..160c55a 100644
--- a/node_modules/@subsquid/squid-gen-evm/lib/core.js
+++ b/node_modules/@subsquid/squid-gen-evm/lib/core.js
@@ -38,6 +38,14 @@ class CoreCodegen {
`new Date(block.header.timestamp)`,
]);
this.out.line();
+ let rangeTo = this.options.contracts[0].range.to;
+ this.out.block(`if (typeof ${rangeTo} !== 'undefined' && block.header.height >= Number(${rangeTo}))`, () => {
+ this.out.line(`ctx.store.setForceFlush(true)`);
+ });
+ this.out.block(`else if (typeof ${rangeTo} === 'undefined')`, () => {
+ this.out.line(`ctx.store.setForceFlush(true)`);
+ });
+ this.out.line();
this.out.block(`for (let log of block.logs)`, () => {
for (let contract of this.options.contracts) {
this.out.block(`if (log.address === '${contract.address}')`, () => {
@@ -67,6 +67,7 @@ class CoreCodegen {
});
});
this.out.line();
+ this.out.line(`ctx.store.setForceFlush(true)`);
targetPrinter.printPostBatch();
});
this.out.line(`})`);
diff --git a/node_modules/@subsquid/squid-gen-evm/lib/interfaces.d.ts b/node_modules/@subsquid/squid-gen-evm/lib/interfaces.d.ts
index 0d82fa8..cb0e924 100644
--- a/node_modules/@subsquid/squid-gen-evm/lib/interfaces.d.ts
Expand Down

0 comments on commit 23c7237

Please sign in to comment.