Skip to content

Commit

Permalink
fix: add env var to toggle continuity check
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Sep 17, 2024
1 parent 2ea16aa commit 17e26ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ const schema = Type.Object({
),
/** If the API should automatically shut down when Ordhook ingestion mode is `replay` */
ORDHOOK_REPLAY_INGESTION_MODE_AUTO_SHUTDOWN: Type.Boolean({ default: true }),
/**
* If the API should check that streamed blocks received from Ordhook are contiguous (without
* inscription number gaps).
*/
ORDHOOK_STREAMED_BLOCK_CONTINUITY_CHECK: Type.Boolean({ default: true }),

PGHOST: Type.String(),
PGPORT: Type.Number({ default: 5432, minimum: 0, maximum: 65535 }),
Expand Down
3 changes: 2 additions & 1 deletion src/pg/pg-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ export class PgStore extends BasePgStore {
}
switch (direction) {
case 'apply':
if (streamed) await this.assertNextBlockIsContiguous(sql, event, cache);
if (streamed && ENV.ORDHOOK_STREAMED_BLOCK_CONTINUITY_CHECK)
await this.assertNextBlockIsContiguous(sql, event, cache);
await this.applyInscriptions(sql, cache, streamed);
break;
case 'rollback':
Expand Down

0 comments on commit 17e26ad

Please sign in to comment.