amphp/parallel

Sock files are piling up in tmp folder. They are not getting cleared up automatically.

MindGamer7 opened this issue · 2 comments

I am using simple code similar to as follow as shown in AMPHP parallel example. However, sock files in tmp folder keep piling up
`$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,
));

class FetchTask implements Task
{
public function __construct(
private readonly string $url,
) {
}

public function run(Channel $channel, Cancellation $cancellation): string
{
    return file_get_contents($this->url); // Example blocking function
}

}
`
The code runs fine but sock files are not cleared in system tmp folder. Please any suggestion what need to be done?