8000 Singleton Curl initializing for running PHP apps as a daemon · Issue #46439 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Singleton Curl initializing for running PHP apps as a daemon  #46439
Closed
@mertingen

Description

@mertingen

Description

I've got the following design. Symfony App is run in Swoole Worker. It means it's alive permanently and runs as a daemon.

Clients -> Symfony App with HTTP Client -> external services

When we got a request from clients, we send a POST HTTP request to the external services. These external services support "Connection: keep-alive" but Symfony HTTP Client creates Curl Handler for each request. Therefore I cannot refer to "keep-alive connection" because it creates a TCP Connection always but I'd like to use created one previously.

In the "CurlHTTPClient" file, this code is run for each request.

if (!$pushedResponse) {
    $ch = curl_init();
    $this->logger && $this->logger->info(sprintf('Request: "%s %s"', $method, $url));
    $curlopts += [\CURLOPT_SHARE => $this->multi->share];
}

Is there an option to keep this curl handler for the next requests from clients in Symfony HTTP Client?

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0