imagify-plugin icon indicating copy to clipboard operation
imagify-plugin copied to clipboard

Adjust priority for template_redirect

Open wordpressfan opened this issue 1 year ago • 2 comments

Description

Fixes #891

Documentation

User documentation

As mentioned in the issue itself, here we fixed the priority of template_redirect hook's callback to be 10 instead of -1000 to fix the buffer closing conflict with WP Rocket.

Technical documentation

Just changed the priority.

Type of change

Delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue).
  • [x] Enhancement (non-breaking change which improves an existing functionality).

New dependencies

List any new dependencies that are required for this change.

Risks

As I mentioned here: https://github.com/wp-media/imagify-plugin/issues/891#issuecomment-2283827408

We added this -1000 priority in the mentioned PR to support rocket CDN so I tested this and it works so we may need to check another CDN plugin to see how it works with this branch.

Checklists

Feature validation

  • [x] I validated all the Acceptance Criteria. If possible, provide sreenshots or videos.
  • [x] I triggered all changed lines of code at least once without new errors/warnings/notices.
  • [ ] I implemented built-in tests to cover the new/changed code.

Documentation

  • [x] I prepared the user documentation for the feature/enhancement and shared it in the PR or the GitHub issue.
  • [ ] The user documentation covers new/changed entry points (endpoints, WP hooks, configuration files, ...).
  • [x] I prepared the technical documentation if needed, and shared it in the PR or the GitHub issue.

Code style

  • [x] I wrote self-explanatory code about what it does.
  • [ ] I wrote comments to explain why it does it.
  • [ ] I named variables and functions explicitely.
  • [ ] I protected entry points against unexpected inputs.
  • [x] I did not introduce unecessary complexity.
  • [ ] I listed the introduced external dependencies explicitely on the PR.
  • [ ] I validated the repo-specific guidelines from CONTRIBUTING.md.

Observability

  • [ ] I handled errors when needed.
  • [ ] I wrote user-facing messages that are understandable and provide actionable feedbacks.
  • [ ] I prepared ways to observe the implemented system (logs, data, etc.).

Risks

  • [x] I explicitely mentioned performance risks in the PR.
  • [ ] I explicitely mentioned security risks in the PR.

wordpressfan avatar Aug 13 '24 11:08 wordpressfan

@wordpressfan thanks for the PR. Here are the test results using imagify and WPR so far https://docs.google.com/spreadsheets/d/1YpkRpc_PkcszOezpkIooWC6hIWnkIWnXITvoHNjEjIo/edit?gid=0#gid=0 1- Are we going to handle the case in C6 here? 2- Is the o/p on C2 and C7 expected? 3- Do we need other GH about lcp loaded twice in NW and CDN not writing lcp totally? @piotrbak

Note: for row 2 , the behavior is different if we used LL plugin instead of enable the option in WPR , with LL plugin the lcp won't be excluded from LL at all. any idea why LL plugin behaves differently than LL in WPR ? (test page https://new.rocketlabsqa.ovh/gallery/)

Mai-Saad avatar Aug 16 '24 09:08 Mai-Saad

@wordpressfan As per discussion with @piotrbak we need to handle the C6 related scenario 1- Enable display picture 2- Enable CDN, LL image 3- Visit page have no lcp yet => lcp is added to DB 4- Clear cache and revisit the page => lcp /atf shall be excluded from LL (currently it is not LL)

  • CDN rewrite issues can be handled here https://github.com/wp-media/wp-rocket/issues/6652
  • Loading LCP image twice can have a separate issue

Mai-Saad avatar Aug 20 '24 09:08 Mai-Saad

Rocket lazyload plugin uses a priority of 2 on template_redirect, same as WP Rocket

remyperona avatar Sep 26 '24 14:09 remyperona