Horizon: Call to undefined method Illuminate\Queue\RedisQueue::readyNow()

Created on 27 Jul 2017  路  17Comments  路  Source: laravel/horizon

I'm yet to figure out why this is happening...

protected function timeToClearPerQueue(Supervisor $supervisor, Collection $pools)
--
聽 | {
聽 | return $pools->mapWithKeys(function ($pool, $queue) use ($supervisor) {
聽 | $size = $this->queue->connection($supervisor->options->connection)->readyNow($queue);
聽 | 聽
聽 | return [$queue => ($size * $this->metrics->runtimeForQueue($queue))];
聽 | });


Most helpful comment

This issue is there in Laravel 5.8 too

All 17 comments

I restarted nginx and this worked. Odd.

Scrap that. Still an issue.

Looks like for some reason Horizon redis connector is not being use and Laravel's connector is used instead, make sure you're running latest 5.5 code.

For extra debugging, make sure HorizonServiceProvider::registerQueueConnectors is called while the app is booting up.

Ah, I was using Laravel 5.4

Is that the issue here?

@jbrooksuk we never tested Horizon on 5.4, it was meant to be run on 5.5, also some minor changes happened in 5.5 core to make Horizon work, like predis support. So I believe it's better not to run it on 5.4

Oh, I thought @taylorotwell said it turns out he'd been testing it on 5.4 馃槅

I didn't know that, all my testing was on 5.5 and I believe Taylor was doing the same. Leaving it for Taylor to decide if we should make sure it works on 5.4 as well then 馃槂

馃憤

@themsaid would you mind let me know where exactly I can put "HorizonServiceProvider::registerQueueConnectors" to have extra debug when "Call to undefined method Illuminate\Queue\RedisQueue::readyNow()" occurs please ?

also seems this method is protected

This should be fixed in latest version

This issue happens for me as well, on homestead with php 7.1, horizon 0.1.0 using database queue and laravel 5.5.20.
The error message:
[2017-11-11 18:07:08] local.ERROR: Call to undefined method Illuminate\Queue\DatabaseQueue::readyNow() {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to undefined method Illuminate\\Queue\\DatabaseQueue::readyNow() at /home/vagrant/code/MovieFriendsParent/server/vendor/laravel/horizon/src/WaitTimeCalculator.php:108)

+1 happened on my side as well using laravel 5.5.

Call to undefined method Illuminate\Queue\RedisQueue::readyNow() {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to undefined method Illuminate\\Queue\\RedisQueue::readyNow() at /var/www/app/public_html/vendor/laravel/horizon/src/AutoScaler.php:80)

EDIT : In fact I did not read enough the docs and it is because it only works for redis driver and not database...

Issue still happening for me.
No idea how to stop that from happening (my error logs are exploding due to this error)
laravel/framework: v5.5.39
laravel/horizon: v1.2.3

my config/horizon.php file :

'waits' => [
        'redis:default' => 45,
        'database:default' => 1150,
],    

'environments' => [
        'production' => [
            'supervisor-1' => [
                'connection' => 'redis',
                'queue' => ['default'],
                'balance' => 'simple',
                'processes' => 2,
                'tries' => 1,
            ],
            'supervisor-2' => [
                'connection' => 'database',
                'queue' => ['default'],
                'balance' => 'simple',
                'processes' => 1,
                'tries' => 1,
            ],
        ],
],

and my config/queue.php file :

'connections' => [
        'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 1205,
        ],
        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => 'default',
            'retry_after' => 60,
        ],
    ],

This issue is there in Laravel 5.8 too

I had the same issue using laravel 5.8 and spent a lot of time aroud. The problem was in serviceProvider initialization order.
For installing Horizon i change my composer to
"dont-discover": [
"laravel/horizon"
]

and after this i override my HorizonApplicationServiceProvider as
`class HorizonApplicationServiceProvider extends \Laravel\Horizon\HorizonApplicationServiceProvider
{
public function boot()
{
parent::boot();
$this->app->register(HorizonServiceProvider::class);
}

protected function gate()
{
    Gate::define('viewHorizon', function ($user) {
        return true;
        return Hash::check(config('horizon.password'), $user->password) and $user->email === config('horizon.email');
    });
}

}
this is not correct. solution for this issue in next: 1) remote from dont-discover "laravel/horizon" so it will load in right order. 2) create another serviceProvider for auth purpose only:
class HorizonApplicationServiceProvider extends \Laravel\Horizon\HorizonApplicationServiceProvider
{
public function boot()
{
parent::boot();
}

protected function gate()
{
    Gate::define('viewHorizon', function ($user) {
        return true;
        return Hash::check(config('horizon.password'), $user->password) and $user->email === config('horizon.email');
    });
}

}`

register your own HorizonApplicationServiceProvider manually in config/app.php

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lasselehtinen picture lasselehtinen  路  3Comments

Pustiu picture Pustiu  路  5Comments

pmartelletti picture pmartelletti  路  4Comments

RicardoRamirezR picture RicardoRamirezR  路  3Comments

etiennellipse picture etiennellipse  路  3Comments