diff --git a/packages/ozone/src/daemon/event-pusher.ts b/packages/ozone/src/daemon/event-pusher.ts index 9b45c0185df..8efec451fdd 100644 --- a/packages/ozone/src/daemon/event-pusher.ts +++ b/packages/ozone/src/daemon/event-pusher.ts @@ -151,6 +151,7 @@ export class EventPusher { .forUpdate() .skipLocked() .where('confirmedAt', 'is', null) + .where('attempts', '<', 10) .execute() if (toPush.length === 0) return false await Promise.all( @@ -168,6 +169,7 @@ export class EventPusher { .forUpdate() .skipLocked() .where('confirmedAt', 'is', null) + .where('attempts', '<', 10) .execute() if (toPush.length === 0) return false await Promise.all(toPush.map((evt) => this.attemptBlobEvent(dbTxn, evt))) diff --git a/packages/ozone/src/db/migrations/20231219T205730722Z-init.ts b/packages/ozone/src/db/migrations/20231219T205730722Z-init.ts index 2f2b3f91dab..87c47682dfb 100644 --- a/packages/ozone/src/db/migrations/20231219T205730722Z-init.ts +++ b/packages/ozone/src/db/migrations/20231219T205730722Z-init.ts @@ -94,6 +94,11 @@ export async function up(db: Kysely): Promise { 'eventType', ]) .execute() + await db.schema + .createIndex('repo_push_confirmation_idx') + .on('repo_push_event') + .columns(['confirmedAt', 'attempts']) + .execute() await db.schema .createTable('record_push_event') @@ -115,6 +120,11 @@ export async function up(db: Kysely): Promise { .on('record_push_event') .columns(['subjectDid', 'eventType']) .execute() + await db.schema + .createIndex('record_push_confirmation_idx') + .on('record_push_event') + .columns(['confirmedAt', 'attempts']) + .execute() await db.schema .createTable('blob_push_event') @@ -132,6 +142,11 @@ export async function up(db: Kysely): Promise { 'eventType', ]) .execute() + await db.schema + .createIndex('blob_push_confirmation_idx') + .on('blob_push_event') + .columns(['confirmedAt', 'attempts']) + .execute() } export async function down(db: Kysely): Promise {