public function getBugsFromLogs()

in app/classes/ReleaseInsights/Beta.php [131:179]


    public function getBugsFromLogs(): array
    {
        // Create a HandlerStack
        $stack = HandlerStack::create();
        $TTL = 600;

        $cache_storage = new Psr6CacheStorage(
            new FilesystemAdapter(
                'guzzle', // Cache folder name
                $TTL,
                CACHE_PATH
            )
        );

        // Add Cache Method
        $stack->push(
            new CacheMiddleware(
                new GreedyCacheStrategy(
                    $cache_storage,
                    $TTL // the TTL in seconds
                )
            ),
            'greedy-cache'
        );

        // Initialize the client with the handler option
        $client = new Client(['handler' => $stack, 'base_uri' => URL::Mercurial->value]);

        // Initiate each request but do not block
        $promises = [];
        foreach ($this->getLogEndpoints() as $beta => $query) {
            $promises[$beta] = $client->getAsync($query);
        }

        $responses = Promise::settle($promises)->wait();

        $beta_logs = [];
        foreach ($responses as $key => $json_log) {
            $data = $json_log['value']->getBody()->getContents();
            $beta_logs[$key] = Bugzilla::getBugsFromHgWeb(
                query: $data,
                detect_backouts: true,
                cache_ttl: 3600*24
            );
        }

        // Wait for the requests to complete, even if some of them fail
        return $beta_logs;
    }