• litetim

    (@litetim)


    Hello
    I am part of Litespeed Cache plugin team.
    We are working on some changes to our plugin and we are testing the changes for compatiblity with other plugins.
    We debugged a situation that is happening when your plugin enabled. We narrow down to function: litespeedReset($post_id) in /classes/cache.php
    The action added is litespeed_media_reset. That is doing more than clearing cache, it clears LSC meta data and image that is added to optimization queue.

    Let’s try changing to do_action( ‘litespeed_purge_all’ )

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Pedro

    (@petredobrescu)

    Hello @litetim and thanks for getting in touch!

    The action added is litespeed_media_reset. That is doing more than clearing cache, it clears LSC meta data and image that is added to optimization queue.

    This is actually the reason why we chose this action. Considering that our plugin replaces the image with a completely new one, the associated meta data is obsolete (since it was for the previous image) and the new image should be added to the optimization queue, so it is optimized again, won’t you agree with this?

    Thanks

    Thread Starter litetim

    (@litetim)

    @petredobrescu
    I agree 🙂 Nothing to add there.

    Can clean up run before making the changes?
    Hooks like: wp_update_attachment_metadata or wp_generate_attachment_metadata will use new main image uploaded/renamed. Right?

    Plugin Author Pedro

    (@petredobrescu)

    hello @litetim,

    We are already using both of them 🙂

    Maybe it would be easier if you could tell us what are the issues you are facing and we’ll do our best to reproduce them and get them fixed with your help. Are there situations when the replacement doesn’t work as expected, or what is going on?

    Thanks

    Thread Starter litetim

    (@litetim)

    @petredobrescu

    We are working on changes, They are found on our dev branch.
    You can install this test version from LSC => Toolbox => Beta test, click on Use latest GitHub Dev commit and click on Ugrade.
    Enable image optimization and set to format to WEBP or AVIF. Also make sure: https://docs.litespeedtech.com/lscache/lscwp/imageopt/#auto-request-cron is ON
    Upload a image to media,
    Check database, table: litespeed_img_optming to see if image(and subsizes) were added for optimization.

    When doing replacement:
    – while image is uploading and is being processed: image and sizes are added in the optimization table
    – AFTER all hooks terminated running there is the action: litespeed_media_reset that run. This action will reset all LSC data created and remove the image from queue( Code is here: https://github.com/litespeedtech/lscache_wp/blob/dev/src/media.cls.php#L252 )

    If you are more confortable: we have a slack workspace where we can talk directly https://www.litespeedtech.com/slack

    Plugin Author Pedro

    (@petredobrescu)

    @litetim I understand now the issue.

    What would be your suggestion? What can we use instead of <strong>litespeed_media_reset</strong> to clear all caches without removing the image from the plugin’s optimization queue? Should we fire this action earlier, before the image is added to the queue? Would you be able to add the image to the queue later, so the <strong>litespeed_media_reset</strong> action is already finished?

    Thread Starter litetim

    (@litetim)

    @petredobrescu Let’s try changing litespeed_media_reset to do_action( ‘litespeed_purge_all’ )

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.