increase global timeout to 9s to prevent timeouts and graceful fallback sooner at 7.25s
All checks were successful
Build and push image for doorman-homeassistant / docker (push) Successful in 55s
Build and push Doorman UI / API / docker (push) Successful in 2m14s
Build and push image for doorman-homeassistant / deploy-gitainer (push) Successful in 6s

This commit is contained in:
Martin Dimitrov 2025-09-02 20:10:49 -07:00
parent f3863719b5
commit 512feb0268
2 changed files with 24 additions and 24 deletions

View File

@ -64,7 +64,7 @@ const FALLBACK_CALLBACK: CallbackResult = [null, REJECT_RESPONSE];
const MINIMUM_MS_TO_SEND_RESPONSE: number = 250; const MINIMUM_MS_TO_SEND_RESPONSE: number = 250;
const FUNCTION_MAXIMUM_DURATION_MS: number = 10_000; const FUNCTION_MAXIMUM_DURATION_MS: number = 10_000;
const INNER_HANDLER_MAXIMUM_DURATION_MS: number = 8_500; const INNER_HANDLER_MAXIMUM_DURATION_MS: number = 9_000;
/** /**
* A decorator for twilio handlers. It provides a metrics registry and * A decorator for twilio handlers. It provides a metrics registry and
@ -103,7 +103,7 @@ export function withMetrics<T extends DoormanLambdaContext, U extends BaseEvent>
metricsRegistry.registerMetric(new Counter({ metricsRegistry.registerMetric(new Counter({
name: CommonMetrics.HTTP_CLIENT_ERROR, name: CommonMetrics.HTTP_CLIENT_ERROR,
help: "Client side HTTP error", help: "Client side HTTP error",
labelNames: [ "ErrorCode" ], labelNames: ["ErrorCode"],
})); }));
metricsRegistry.registerMetric(new Counter({ metricsRegistry.registerMetric(new Counter({

View File

@ -19,7 +19,7 @@ import { getMetricFromRegistry, withMetrics } from '../../../doorman-api/src/com
import { Counter, Summary } from 'prom-client'; import { Counter, Summary } from 'prom-client';
import { BuzzerActivatedMetrics, registerMetrics } from '../metrics/BuzzerActivatedMetrics'; import { BuzzerActivatedMetrics, registerMetrics } from '../metrics/BuzzerActivatedMetrics';
export const handler: ServerlessFunctionSignature<TwilioContext, BuzzerDialEvent> = withMetrics('buzzer-activated', async function(context, event, callback, metricsRegistry, logger, failFastCallback) { export const handler: ServerlessFunctionSignature<TwilioContext, BuzzerDialEvent> = withMetrics('buzzer-activated', async function (context, event, callback, metricsRegistry, logger, failFastCallback) {
// metrics // metrics
registerMetrics(metricsRegistry); registerMetrics(metricsRegistry);
@ -34,7 +34,7 @@ export const handler: ServerlessFunctionSignature<TwilioContext, BuzzerDialEvent
} else { } else {
try { try {
config = JSON.parse(configString); config = JSON.parse(configString);
} catch(e) { } catch (e) {
config = await getConfig(context, event.From); config = await getConfig(context, event.From);
} }
} }
@ -123,7 +123,7 @@ export const handler: ServerlessFunctionSignature<TwilioContext, BuzzerDialEvent
invokeId + " GracefulFallbackPromise: dropping out of the race, another response is already underway" invokeId + " GracefulFallbackPromise: dropping out of the race, another response is already underway"
); );
} }
}, 7500)); }, 7_250));
}); });
// provide a method to the decorator to use as a fast fallback that shouldn't have any await // provide a method to the decorator to use as a fast fallback that shouldn't have any await