@@ -291,8 +291,7 @@ public function updateSummary(array $data): void
291291 if (false === $ json ) {
292292 throw new RuntimeException (json_last_error_msg ());
293293 }
294- $ this ->redis ->setNx ($ metaKey , $ json );
295- /** @phpstan-ignore-line */
294+ $ this ->redis ->setnx ($ metaKey , $ json );
296295
297296 // store value key
298297 $ valueKey = $ summaryKey . ': ' . $ this ->valueKey ($ data );
@@ -301,8 +300,7 @@ public function updateSummary(array $data): void
301300 if (false === $ json ) {
302301 throw new RuntimeException (json_last_error_msg ());
303302 }
304- $ this ->redis ->setNx ($ valueKey , $ json );
305- /** @phpstan-ignore-line */
303+ $ this ->redis ->setnx ($ valueKey , $ json );
306304
307305 // trick to handle uniqid collision
308306 $ done = false ;
@@ -528,10 +526,15 @@ private function collectSummaries(): array
528526 }
529527 }
530528 if (count ($ samples ) === 0 ) {
531- $ this ->redis ->del ($ valueKey );
529+ if (isset ($ valueKey )) {
530+ $ this ->redis ->del ($ valueKey );
531+ }
532+
532533 continue ;
533534 }
534535
536+ assert (isset ($ decodedLabelValues ));
537+
535538 // Compute quantiles
536539 sort ($ samples );
537540 foreach ($ data ['quantiles ' ] as $ quantile ) {
@@ -560,11 +563,7 @@ private function collectSummaries(): array
560563 ];
561564
562565
563- if (count ($ data ['samples ' ]) > 0 ) {
564- $ summaries [] = $ data ;
565- } else {
566- $ this ->redis ->del ($ metaKey );
567- }
566+ $ summaries [] = $ data ;
568567 }
569568 return $ summaries ;
570569 }
0 commit comments