mirror of
https://github.com/flarum/framework.git
synced 2025-02-06 11:51:45 +08:00
Fixes the queue listen command. We might need to rectify this implementation before stable.
This commit is contained in:
parent
923eea1cd8
commit
58e1c6cd99
15
framework/core/src/Queue/Console/ListenCommand.php
Normal file
15
framework/core/src/Queue/Console/ListenCommand.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Flarum\Queue\Console;
|
||||
|
||||
use Illuminate\Queue\Listener;
|
||||
|
||||
class ListenCommand extends \Illuminate\Queue\Console\ListenCommand
|
||||
{
|
||||
public function __construct(Listener $listener)
|
||||
{
|
||||
parent::__construct($listener);
|
||||
|
||||
$this->addOption('env');
|
||||
}
|
||||
}
|
15
framework/core/src/Queue/Listener.php
Normal file
15
framework/core/src/Queue/Listener.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Flarum\Queue;
|
||||
|
||||
use Illuminate\Queue\ListenerOptions;
|
||||
|
||||
class Listener extends \Illuminate\Queue\Listener
|
||||
{
|
||||
protected function addEnvironment($command, ListenerOptions $options)
|
||||
{
|
||||
$options->environment = null;
|
||||
|
||||
return $command;
|
||||
}
|
||||
}
|
|
@ -18,8 +18,8 @@ use Illuminate\Contracts\Queue\Factory;
|
|||
use Illuminate\Queue\Connectors\ConnectorInterface;
|
||||
use Illuminate\Queue\Console as Commands;
|
||||
use Illuminate\Queue\Failed\NullFailedJobProvider;
|
||||
use Illuminate\Queue\Listener;
|
||||
use Illuminate\Queue\SyncQueue;
|
||||
use Illuminate\Queue\Listener as QueueListener;
|
||||
use Illuminate\Queue\Worker;
|
||||
|
||||
class QueueServiceProvider extends AbstractServiceProvider
|
||||
|
@ -27,7 +27,7 @@ class QueueServiceProvider extends AbstractServiceProvider
|
|||
protected $commands = [
|
||||
Commands\FlushFailedCommand::class,
|
||||
Commands\ForgetFailedCommand::class,
|
||||
// Commands\ListenCommand::class,
|
||||
Console\ListenCommand::class,
|
||||
Commands\ListFailedCommand::class,
|
||||
// Commands\RestartCommand::class,
|
||||
Commands\RetryCommand::class,
|
||||
|
@ -36,6 +36,8 @@ class QueueServiceProvider extends AbstractServiceProvider
|
|||
|
||||
public function register()
|
||||
{
|
||||
define('ARTISAN_BINARY', 'flarum');
|
||||
|
||||
// Register a simple connection factory that always returns the same
|
||||
// connection, as that is enough for our purposes.
|
||||
$this->app->singleton(Factory::class, function () {
|
||||
|
@ -65,7 +67,7 @@ class QueueServiceProvider extends AbstractServiceProvider
|
|||
);
|
||||
});
|
||||
|
||||
$this->app->singleton(Listener::class, function ($app) {
|
||||
$this->app->singleton(QueueListener::class, function ($app) {
|
||||
return new Listener($app->basePath());
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user