Skip to content

Commit

Permalink
feat: Updated src/Snps/Utils.php
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Mar 10, 2024
1 parent 1227a1d commit 9f16ca7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Snps/Utils.php
Expand Up @@ -57,11 +57,8 @@ public function __invoke(callable $f, array $tasks): array
// Implement parallel (multi-process) execution using pthreads, parallel or another multi-processing library
// For example, using the parallel extension:
$runtime = new \parallel\Runtime();
$promises = [];
foreach ($tasks as $task) {
$promises[] = $runtime->run($f, [$task]);
}
return array_map(fn ($promise) => $promise->value(), $promises);
$promises = array_map(fn($task) => $runtime->run($f, [$task]), $tasks);
return array_map(fn($promise) => $promise->value(), $promises);
} else {
return array_map($f, $tasks);
}
Expand Down

0 comments on commit 9f16ca7

Please sign in to comment.