public function execute()
 {
     $registeredSegments = $this->cache()->getItemsOnList(SegmentCache::getCacheKeyForRegisterSegments());
     $log = $this->logger();
     if (is_array($registeredSegments) && !empty($registeredSegments)) {
         foreach ($registeredSegments as $segmentName) {
             $log->info(">>> Fetching data from segment: {$segmentName}");
             $timeStart = Latency::startMeasuringLatency();
             while (true) {
                 $timeStartPart = Latency::startMeasuringLatency();
                 if (!$this->getSplitClient()->updateSegmentChanges($segmentName)) {
                     $timeItTook = Latency::calculateLatency($timeStartPart);
                     $log->debug("Fetching segment last part ({$segmentName}) took {$timeItTook} microseconds");
                     $greedyTime = Latency::calculateLatency($timeStart);
                     $log->info("Finished fetching whole segment {$segmentName}, took {$greedyTime} microseconds");
                     break;
                 }
                 $timeItTook = Latency::calculateLatency($timeStartPart);
                 $log->debug("Fetching segment part ({$segmentName}) took {$timeItTook} microseconds");
                 //Sleep 1/2 second
                 usleep(500000);
             }
         }
         // Setting Segments ready mark
         $dateTimeUTC = new \DateTime("now", new \DateTimeZone("UTC"));
         $bur = new BlockUntilReadyCache();
         $bur->setReadySegments($dateTimeUTC->getTimestamp());
     }
 }
 /**
  * @depends testDiLog
  * @depends testDiCache
  */
 public function testBlockUntilReadyCacheInterface()
 {
     $dateTimeUTC = new \DateTime("now", new \DateTimeZone("UTC"));
     $deltaTime = 100;
     $splitsTimestamp = $dateTimeUTC->getTimestamp();
     $segmentsTimestamp = $dateTimeUTC->getTimestamp() + $deltaTime;
     $bur = new BlockUntilReadyCache();
     $bur->setReadySplits($splitsTimestamp);
     $bur->setReadySegments($segmentsTimestamp);
     //Checking
     $this->assertEquals($splitsTimestamp, $bur->getReadySplits());
     $this->assertEquals($segmentsTimestamp, $bur->getReadySegments());
     $this->assertEquals(min($splitsTimestamp, $segmentsTimestamp), $bur->getReadyCheckpoint());
 }