diff --git a/bin/stacks/api-stack.ts b/bin/stacks/api-stack.ts index 1067d35..cab2eea 100644 --- a/bin/stacks/api-stack.ts +++ b/bin/stacks/api-stack.ts @@ -440,10 +440,10 @@ export class APIStack extends cdk.Stack { alarmName: 'UniswapXParameterizationAPI-SEV2-5XX', metric: api.metricServerError({ period: Duration.minutes(5), - // For this metric 'avg' represents error rate. - statistic: 'avg', + // For this metric 'sum' represents error count. + statistic: 'sum', }), - threshold: 0.5, + threshold: 100, // Beta has much less traffic so is more susceptible to transient errors. evaluationPeriods: stage == STAGE.BETA ? 5 : 3, }); @@ -455,7 +455,7 @@ export class APIStack extends cdk.Stack { // For this metric 'sum' represents error count. statistic: 'sum', }), - threshold: 100, + threshold: 20, // Beta has much less traffic so is more susceptible to transient errors. evaluationPeriods: stage == STAGE.BETA ? 5 : 3, }); diff --git a/lib/handlers/hard-quote/injector.ts b/lib/handlers/hard-quote/injector.ts index 43a0197..89240ae 100644 --- a/lib/handlers/hard-quote/injector.ts +++ b/lib/handlers/hard-quote/injector.ts @@ -42,11 +42,7 @@ export class QuoteInjector extends ApiInjector { + if (this.fillerEndpoints.length === 0) { + this.fillerEndpoints = this.webhookProvider.fillerEndpoints(); + this.lastUpdatedTimestamp = Date.now(); + } + return this.fillerEndpoints; + } + async getConfigurations(): Promise { if ( - this.fillerEndpoints.length === 0 || + (await this.getFillerEndpoints()).length === 0 || Date.now() - this.lastUpdatedTimestamp > DynamoCircuitBreakerConfigurationProvider.UPDATE_PERIOD_MS ) { await this.fetchConfigurations(); @@ -44,7 +53,7 @@ export class DynamoCircuitBreakerConfigurationProvider implements CircuitBreaker } async fetchConfigurations(): Promise { - this.timestamps = await this.timestampDB.getFillerTimestampsMap(this.fillerEndpoints); + this.timestamps = await this.timestampDB.getFillerTimestampsMap(await this.getFillerEndpoints()); } /* add filler to `enabled` array if it's not blocked until a future timestamp;