Pool example

public function ban(array $urls): void
    {
        $list = [];

        foreach ($urls as $url) {
            foreach ($this->hosts as $host) {
                $list[] = new Request($this->singlePurge['method']$host . $url$this->singlePurge['headers']);
            }
        }

        $pool = new Pool($this->client, $list[
            'concurrency' => $this->concurrency,
            'rejected' => function DTransferException $reason): void {
                if ($reason instanceof ServerException) {
                    throw new \RuntimeException(\sprintf('BAN request failed to %s failed with error: %s', $reason->getRequest()->getUri()->__toString()$reason->getMessage()), 0, $reason);
                }

                throw $reason;
            },
        ]);

        $pool->promise()->wait();
    }
public function ban(array $urls): void
    {
        $list = [];

        foreach ($urls as $url) {
            $list[] = new Request('POST', self::API_URL . '/purge/' . $this->appUrl . $url[
                'Fastly-Key' => $this->apiKey,
                'fastly-soft-purge' => $this->softPurge,
            ]);
        }

        $pool = new Pool($this->client, $list[
            'concurrency' => $this->concurrency,
            'rejected' => function DTransferException $reason): void {
                if ($reason instanceof ServerException) {
                    throw new \RuntimeException(\sprintf('BAN request failed to %s failed with error: %s', $reason->getRequest()->getUri()->__toString()$reason->getMessage()), 0, $reason);
                }

                throw $reason;
            },
        ]);

        $pool->promise()->wait();
    }
$response->headers->set('xkey', implode(' ', $tags));
    }

    public function invalidate(array $tags): void
    {
        $list = [];

        foreach ($this->hosts as $host) {
            $list[] = new Request('PURGE', $host['xkey' => implode(' ', $tags)]);
        }

        $pool = new Pool($this->client, $list[
            'concurrency' => $this->concurrency,
            'rejected' => function DTransferException $reason): void {
                if ($reason instanceof ServerException) {
                    throw new \RuntimeException(sprintf('BAN request failed to %s failed with error: %s', $reason->getRequest()->getUri()->__toString()$reason->getMessage()), 0, $reason);
                }

                throw $reason;
            },
        ]);

        $pool->promise()->wait();
    }
if (!empty($this->getMainShopId($shopId))) {
            $guzzleConfig['Cookie'] = 'shop=' . $shopId;
        }

        $requests = [];
        foreach ($urls as $url) {
            $requests[] = new Request('GET', $url$guzzleConfig);
        }

        $events = $this->eventManager;

        $pool = new Pool(
            $this->guzzleClient,
            $requests,
            [
                'concurrency' => $concurrentRequests,
                'rejected' => function D$reason) use ($shopId$events) {
                    $events->notify('Shopware_Components_CacheWarmer_ErrorOccured');
                    $this->logger->warning(
                        'Warm up http-cache error with shopId ' . $shopId . ' ' . $reason
                    );
                },
            ]
        );
if ($webhook->getApp() !== null && $webhook->getApp()->getAppSecret() !== null) {
                $request = $request->withHeader(
                    RequestSigner::SHOPWARE_SHOP_SIGNATURE,
                    (new RequestSigner())->signPayload($jsonPayload$webhook->getApp()->getAppSecret())
                );
            }

            $requests[] = $request;
        }

        if (\count($requests) > 0) {
            $pool = new Pool($this->guzzle, $requests);
            $pool->promise()->wait();
        }
    }

    /** * @param array<string> $affectedRoleIds */
    private function dispatchWebhooksToQueue(
        WebhookCollection $webhooksForEvent,
        Hookable $event,
        array $affectedRoleIds,
        
Home | Imprint | This part of the site doesn't use cookies.