ostark / craft-async-queue

Async Queue Handler for Craft 3 and 4
MIT License
93 stars 7 forks source link

Jobs not running after upgrade to Craft 4 #59

Closed RandomJo closed 2 years ago

RandomJo commented 2 years ago

AsyncQueue has stopped working on several sites after upgrading to Craft 4. When I run the AsyncQueue test, 10 jobs get added to the queue but none of them run after running ./craft queue/run in my terminal. When AsyncQueue is not installed, quick jobs do run after running the CLI command, including the AsyncQueue tests (after uninstalling and leaving the jobs there to be processed).

I do see this error when I run ./craft queue/run regardless of whether or not AsyncQueue is installed:

[ERROR] Queue must be an application component. yii\base\InvalidConfigException

It's possible it's related, but I'm having a hard time tracking down the source of that error message.

ostark commented 2 years ago

Sorry, I wasn't able to reproduce it with Craft 4.1 (I'll try it with the latest after fixing my broken setup - yes, something like this happens to me too :-))

ostark commented 2 years ago

Not able to reproduce it with Craft 4.2 either. I assume it is somehow related to your unique config/setup.

I do see this error when I run ./craft queue/run regardless of whether or not AsyncQueue is installed: [ERROR] Queue must be an application component. yii\base\InvalidConfigException

Async Queue runs ./craft queue/run under the hood. If this is broken, it will not work.

~10 lines of the stack trace might be useful to fully understand the issue.

RandomJo commented 2 years ago

Must be something specific to our company project config then.

./craft queue/run works as expected when AsyncQueue is not installed. It gives that error message, but queue items process as expected. Unfortunately, Craft doesn't give me anything for the error other than what I copy/pasted. Do you know if there's a setting or something that would give me a more verbose stack trace? I also do not see anything more within storage/logs/queue.log.

ostark commented 2 years ago

Maybe it is related to old Jobs in the queue (created by Craft 3)?

https://craftcms.com/docs/4.x/upgrade.html#performing-the-upgrade

Make sure you don’t have any pending or active jobs in your queue.

RandomJo commented 2 years ago

I don't believe it's that. There are no jobs in the queue before I run load the AsyncQueue test jobs.

RandomJo commented 2 years ago

We are going to do some more exploring on our end to see if we can isolate which part of our project config makes the difference. We'll report back later. Heads up that it may be another developer on my team who jumps back in.

ostark commented 2 years ago

I think I solved the issue: https://github.com/ostark/craft-relax/releases/tag/2.0.1

(I assume you use the relax plugin too)

RandomJo commented 2 years ago

Yes! We are using it for that project. We'll give this a try and let you know.

corneliusio commented 2 years ago

@ostark Hopping in here for @RandomJo to confirm that the update to the Relax plugin did in fact fix our issue. Thanks for your help on this!

DavidKabelitz commented 2 years ago

@ostark we have the same issue here. Do we need 'runQueueAutomatically' set on true in Craft4? Relax ist not in use by the way :)

ostark commented 2 years ago

@DavidKabelitz Does it happen in all environments? Does ./craft queue/run -v work for you?

DavidKabelitz commented 2 years ago

Nope, looks like we need to check some changes related to Craft4. So it's our fault. Thanks for the quick reply.