@cryptotaxi247 / netdata-1 / commits / bc51a9467

properly count persons and machines after restart

Costa Tsaousis committed May 11, 2016 at 16:01 UTC bc51a94677b03e94fec720cad37f13626a53e3ce
1 file changed +5 -8
src/registry.c
+5 -8
@@ -434,6 +434,7 @@ static inline MACHINE *registry_machine_allocate(const char *machine_guid, time_
434
435 registry.machines_memory += sizeof(MACHINE);
436
437 + registry.machines_count++;
438 dictionary_set(registry.machines, m->guid, m, sizeof(MACHINE));
439
440 return m;
@@ -455,10 +456,7 @@ static inline MACHINE *registry_machine_get(const char *machine_guid, time_t whe
456 else {
457 machine_guid = buf;
458 m = registry_machine_find(machine_guid);
458 - if(!m) {
459 - m = registry_machine_allocate(machine_guid, when);
460 - registry.machines_count++;
461 - }
459 + if(!m) m = registry_machine_allocate(machine_guid, when);
460 }
461 }
462
@@ -568,7 +566,9 @@ static inline PERSON *registry_person_allocate(const char *person_guid, time_t w
566
567 registry.persons_memory += sizeof(PERSON);
568
569 + registry.persons_count++;
570 dictionary_set(registry.persons, p->guid, p, sizeof(PERSON));
571 +
572 return p;
573 }
574
@@ -594,10 +594,7 @@ static inline PERSON *registry_person_get(const char *person_guid, time_t when)
594 }
595 }
596
597 - if(!p) {
598 - p = registry_person_allocate(NULL, when);
599 - registry.persons_count++;
600 - }
597 + if(!p) p = registry_person_allocate(NULL, when);
598
599 registry_persons_unlock();
600