Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jbrooksuk opened this issue Jul 27, 2017 · 18 comments
Closed

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

jbrooksuk opened this issue Jul 27, 2017 · 18 comments

Comments

@jbrooksuk
Copy link
Member

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))];
  | });


@jbrooksuk
Copy link
Member Author

I restarted nginx and this worked. Odd.

@jbrooksuk jbrooksuk reopened this Jul 27, 2017
@jbrooksuk
Copy link
Member Author

Scrap that. Still an issue.

@themsaid
Copy link
Member

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.

@jbrooksuk
Copy link
Member Author

Ah, I was using Laravel 5.4

Is that the issue here?

@themsaid
Copy link
Member

@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

@jbrooksuk
Copy link
Member Author

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

@themsaid
Copy link
Member

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 😃

@jbrooksuk
Copy link
Member Author

👍

@barryvdh
Copy link
Contributor

#41

@francoismart
Copy link

@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 ?

@francoismart
Copy link

francoismart commented Jul 28, 2017

also seems this method is protected

@barryvdh
Copy link
Contributor

This should be fixed in latest version

@dblazeski
Copy link

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)

@azhard4int
Copy link

azhard4int commented Nov 13, 2017

+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)

@tainmar
Copy link

tainmar commented Mar 28, 2018

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,
        ],
    ],

@xyrintech
Copy link

This issue is there in Laravel 5.8 too

@Spartaques
Copy link

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

@jakebarshickf1nx
Copy link

FYI if anyone is experiencing this and landed here from google. Check that "spatie/laravel-ignition" is in require and not require-dev! This is what fixed for me on Laravel 9.

composer require spatie/laravel-ignition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants