1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

Use map method

This commit is contained in:
Gastón Fournier 2024-10-15 10:54:10 +02:00
parent d785730087
commit 05762e9b59
No known key found for this signature in database
GPG Key ID: AF45428626E17A8E

View File

@ -42,10 +42,10 @@ export class DbMetricsMonitor {
};
async getLastValue(name: string): Promise<number | undefined> {
try {
return (await this.gauges[name].gauge.get()).values[0].value;
} catch (e) {
return undefined;
const gauge = await this.gauges.get(name)?.gauge?.get();
if (gauge && gauge.values.length > 0) {
return gauge.values[0].value;
}
return undefined;
}
}