1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00

fix: Store metrics only if not empty (#991)

This commit is contained in:
Ivar Conradi Østhus 2021-09-29 09:47:49 +02:00 committed by GitHub
parent 35f2f92257
commit f6169540a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,8 +140,12 @@ export default class ClientMetricsService {
): Promise<void> { ): Promise<void> {
const value = await clientMetricsSchema.validateAsync(data); const value = await clientMetricsSchema.validateAsync(data);
const toggleNames = Object.keys(value.bucket.toggles); const toggleNames = Object.keys(value.bucket.toggles);
await this.featureToggleStore.setLastSeen(toggleNames);
await this.clientMetricsStore.insert(value); if (toggleNames.length > 0) {
await this.featureToggleStore.setLastSeen(toggleNames);
await this.clientMetricsStore.insert(value);
}
await this.clientInstanceStore.insert({ await this.clientInstanceStore.insert({
appName: value.appName, appName: value.appName,
instanceId: value.instanceId, instanceId: value.instanceId,