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
+6 -2
View File
@@ -140,8 +140,12 @@ export default class ClientMetricsService {
): Promise<void> {
const value = await clientMetricsSchema.validateAsync(data);
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({
appName: value.appName,
instanceId: value.instanceId,