Skip to content

Commit

Permalink
Only use concurrency in console
Browse files Browse the repository at this point in the history
As pointed out in spatie/fork#4, Fork only works in a CLI environment.
  • Loading branch information
jasonvarga committed May 13, 2021
1 parent 2833b2d commit f723c48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class ServiceProvider extends LaravelServiceProvider
{
public function register()
{
$this->app->bind(Tasks::class, function () {
return class_exists(Fork::class)
$this->app->bind(Tasks::class, function ($app) {
return $app->runningInConsole() && class_exists(Fork::class)
? new ConcurrentTasks(new Fork)
: new ConsecutiveTasks;
});
Expand Down

0 comments on commit f723c48

Please sign in to comment.