Amphp parallel adding lots of amp-parallel sock files in php-fpm tmp folder

145 views Asked by At

I am using the following code to submit workers into the queue and then run them with Task.

$executions = [];
foreach ($urls as $url) {
    // FetchTask is just an example, you'll have to implement
    // the Task interface for your task.
    $executions[$url] = Worker\submit(new FetchTask($url));
}

// Each submission returns an Execution instance to allow two-way
// communication with a task. Here we're only interested in the
// task result, so we use the Future from Execution::getFuture()
$responses = Future\await(array_map(
    fn (Worker\Execution $e) => $e->getFuture(),
    $executions,
));

However, I see a lot of amp-parallel-*.sock files in php-fpm tmp directory and it appears to me that there is no clean-up for them.

Is that intended? When and how do these clean-up?

1

There are 1 answers

2
Leandro On

Probably this is the reason, it uses stream_socket_client to open a socket channel: https://github.com/amphp/parallel/blob/1.x/lib/Context/Parallel.php#L188