Skip to content

Commit d35c951

Browse files
feat: return expired deposits to use webhook for status change (#111)
1 parent c5bab8b commit d35c951

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

packages/indexer/src/services/spokePoolProcessor.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ export class SpokePoolProcessor {
7070
// TODO: for new fills, notify status change to filled
7171
// here...
7272

73-
await this.updateExpiredRelays();
73+
const expiredDeposits = await this.updateExpiredRelays();
74+
// TODO: for expired deposits, notify status change to expired
75+
// here...
76+
7477
const refundedDeposits = await this.updateRefundedDepositsStatus();
7578
// TODO: for refunded deposits, notify status change to refunded
7679
// here...
@@ -135,9 +138,9 @@ export class SpokePoolProcessor {
135138

136139
/**
137140
* Updates the status of expired relays originated from this processor's chain id
138-
* @returns A void promise
141+
* @returns An array with the updated relays
139142
*/
140-
private async updateExpiredRelays(): Promise<void> {
143+
private async updateExpiredRelays(): Promise<entities.RelayHashInfo[]> {
141144
const relayHashInfoRepository = this.postgres.getRepository(
142145
entities.RelayHashInfo,
143146
);
@@ -157,11 +160,17 @@ export class SpokePoolProcessor {
157160
entities.RelayStatus.SlowFillRequested,
158161
],
159162
})
163+
.returning("*")
160164
.execute();
161-
this.logger.info({
162-
at: "SpokePoolProcessor#updateExpiredRelays",
163-
message: `Updated status for ${expiredDeposits.generatedMaps.length} expired relays`,
164-
});
165+
166+
if ((expiredDeposits.affected ?? 0) > 0) {
167+
this.logger.info({
168+
at: "SpokePoolProcessor#updateExpiredRelays",
169+
message: `Updated status for ${expiredDeposits.affected} expired relays`,
170+
});
171+
}
172+
173+
return expiredDeposits.raw;
165174
}
166175

167176
/**

0 commit comments

Comments
 (0)