Skip to content

Commit

Permalink
feat: return expired deposits to use webhook for status change (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
melisaguevara authored Nov 22, 2024
1 parent c5bab8b commit d35c951
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions packages/indexer/src/services/spokePoolProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export class SpokePoolProcessor {
// TODO: for new fills, notify status change to filled
// here...

await this.updateExpiredRelays();
const expiredDeposits = await this.updateExpiredRelays();
// TODO: for expired deposits, notify status change to expired
// here...

const refundedDeposits = await this.updateRefundedDepositsStatus();
// TODO: for refunded deposits, notify status change to refunded
// here...
Expand Down Expand Up @@ -135,9 +138,9 @@ export class SpokePoolProcessor {

/**
* Updates the status of expired relays originated from this processor's chain id
* @returns A void promise
* @returns An array with the updated relays
*/
private async updateExpiredRelays(): Promise<void> {
private async updateExpiredRelays(): Promise<entities.RelayHashInfo[]> {
const relayHashInfoRepository = this.postgres.getRepository(
entities.RelayHashInfo,
);
Expand All @@ -157,11 +160,17 @@ export class SpokePoolProcessor {
entities.RelayStatus.SlowFillRequested,
],
})
.returning("*")
.execute();
this.logger.info({
at: "SpokePoolProcessor#updateExpiredRelays",
message: `Updated status for ${expiredDeposits.generatedMaps.length} expired relays`,
});

if ((expiredDeposits.affected ?? 0) > 0) {
this.logger.info({
at: "SpokePoolProcessor#updateExpiredRelays",
message: `Updated status for ${expiredDeposits.affected} expired relays`,
});
}

return expiredDeposits.raw;
}

/**
Expand Down

0 comments on commit d35c951

Please sign in to comment.