Skip to content

Too many open files error #150

@tnsezer

Description

@tnsezer

Hi everyone,

I got the too many open files error.
Error: include(/home/forge/xxxx/vendor/guzzlehttp/promises/src/RejectedPromise.php): Failed to open stream: Too many open files

I get the error in a job when I delete orders (12k orders). Graphql delete single order each time that's why I suspect it happens because Guzzle doesn't close connection and it stucks the system.

How I can reset the connection end of the process each time?

My code sample

$orderService->deleteOrder($shop, ['id' => $orderId]);

    public function deleteOrder(User $shop, $variables = [])
    {
        $query = <<<GQL
            mutation(\$id: ID!) {
              orderDelete(orderId: \$id) {
                deletedId
                userErrors {
                  field
                  message
                }
              }
            }
            GQL;

        $result = $shop->api()->graph($query, $variables);

        if ($result['status'] === 429) {
            dd($result);
        }

        return $result['body']['data']->toArray();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions