, failed:list} */ public function verify(Target $target, string $snapshotId, bool $deep = false): array { $ttl = $deep ? 600 : 300; try { return $this->leases->with(PruneService::lockKey($target), LeaseService::SHARED, $ttl, function (callable $refresh) use ($target, $snapshotId, $deep, $ttl) { $last = time(); $heartbeat = function () use ($refresh, $ttl, &$last): void { if (time() - $last >= intdiv($ttl, 2)) { $refresh(); $last = time(); } }; return $this->targets->repository($target)->verify($snapshotId, $deep, $heartbeat); }); } catch (LockedException) { throw new \RuntimeException('A cleanup of ' . $target->getName() . ' is in progress; try again later'); } } }