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:
parent
d785730087
commit
05762e9b59
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user