putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
147 stars 35 forks source link

Maintain compatibility with "Relax" plugin in Blitz >= 3.13.0 #609

Closed hiasl closed 5 months ago

hiasl commented 5 months ago

Hi Ben,

I'm currently on the unreleased version 3.14 of Blitz with Craft 3.8.17.

There is a plugin called "Relax" which tries to improve queue speed by filtering queue tasks before they are pushed into the queue. This is the plugin: https://plugins.craftcms.com/relax / https://github.com/ostark/craft-relax and it currently has about 900 installations.

Here's what I believe and think that I tracked down:

Blitz was compatible with Relax it until 3.12.10. Beginning with 3.13 it became incompatible. What happens now is that all regular Queue Jobs are put into the hashed queue table (by Relax plugin), but only Blitz's jobs are now inserted into the standard queue table, which is not processed as long as Relax is active.

This changed in Blitz's RefreshCacheService: <= 3.12.10: $queue = Craft::$app->getQueue(); and $queue is used afterwards starting with 3.13.0: Blitz::$plugin->queue is used instead.

This is how Relax takes over into the queue: https://github.com/ostark/craft-relax/blob/main/src/Handlers/QueueServiceHandler.php#L39

My guess: if Blitz is loaded first, Blitz::$plugin->queue will still point to Craft's default queue and therefor put its jobs into it.

Please let me know, if you can sort this out, otherwise we have to drop the Relax plugin as Blitz is more important to us :-)

bencroker commented 5 months ago

It sounds like you'll need to request Extrawurst for the Craft 3 version of Relax. See https://github.com/putyourlightson/craft-blitz/issues/591 and https://github.com/ostark/craft-relax/issues/16 for context.

hiasl commented 5 months ago

ok, sorry, did not see/know that. thanks for showing me.