add a fail fast watermark so we can see if a response is fail fast
This commit is contained in:
parent
97956e376e
commit
abf9d43a8c
@ -19,6 +19,8 @@ import { getMetricFromRegistry, withMetrics } from '../../../doorman-api/src/com
|
||||
import { Counter, Summary } from 'prom-client';
|
||||
import { BuzzerActivatedMetrics, registerMetrics } from '../metrics/BuzzerActivatedMetrics';
|
||||
|
||||
const XML_FAIL_FAST_CALLBACK_COMMENT = "<!-- This response is from a fail fast callback -->";
|
||||
|
||||
export const handler: ServerlessFunctionSignature<TwilioContext, BuzzerDialEvent> = withMetrics('buzzer-activated', async function (context, event, callback, metricsRegistry, logger, failFastCallback) {
|
||||
// metrics
|
||||
registerMetrics(metricsRegistry);
|
||||
@ -74,6 +76,7 @@ export const handler: ServerlessFunctionSignature<TwilioContext, BuzzerDialEvent
|
||||
|
||||
await notifyDiscord(context, msgs, config.discordUsers, config.discordUsers.map(() => ""), metricsRegistry);
|
||||
|
||||
// set me to true to simulate a timeout
|
||||
let responseLock = false;
|
||||
let intervals: Timer[] = [];
|
||||
let timeouts: Timer[] = [];
|
||||
@ -167,6 +170,7 @@ export const handler: ServerlessFunctionSignature<TwilioContext, BuzzerDialEvent
|
||||
console.log(
|
||||
invokeId + " UngracefulFallback: Cutting it too close to timeout! Skipping notifying users and responding fallback"
|
||||
);
|
||||
twiml.play(XML_FAIL_FAST_CALLBACK_COMMENT);
|
||||
return [null, twiml];
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user