Support » Plugin: Autoptimize » Critical CSS Plugin

  • Will Stocks

    (@willstockstech)


    Hey Frank,
    I just updated AO to the latest version on my site (about an hour ago) and CCSS has stopped generating. My entire queue is sat at N currently and won’t switch over to P.
    Looking at the CCSS panel as well, I’m not seeing any jobs being sent over since about an hour ago.
    I can’t see any obvious errors being logged on my server either, so not quite sure where to start with this one.
    I even tried re-enabling the old CCSS plugin as well (still installed, just de-activated) and no luck.
    Originally I had WP-Cron disabled and was calling my site via https://cron-job.org/ and that has been working perfectly for about a year now (I can see those jobs are still firing.

Viewing 12 replies - 16 through 27 (of 27 total)
  • Thread Starter Will Stocks

    (@willstockstech)

    Thanks Frank

    So when I fill the queue up with all pages as N – how is it decided what is/isn’t to be processed? Is there a criteria?

    Probably my misunderstanding, but I assumed that if something was queued, it would be generated.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    there you go;

    2020-06-03T08:40:24+00:00 – [DD] Critical CSS file for the rule <paths|/offline/> was saved as <ccss_4e9d61528ad0a92f786174081d67e0de_R.css>, size in bytes is <15985>

    Thread Starter Will Stocks

    (@willstockstech)

    Got it! πŸ™‚

    But why would that need to be individually generated, rather than being picked out of the 60+ rows that were sat in the original queue?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Hard to say as the debug log seems to have just been cleared (either automatically by that maintenance job or manually by you), maybe /offline/ wasn’t in the queue before?

    But based on the debug log for /offline/ all looks sound;

    1. job being created

    2020-06-03T08:26:43+00:00 – [DD] Job CREATED with local job id <j-pa7qsx> for target rule <paths|/offline/>

    2. N job processed and sent to criticalcss.com for CCSS creation (job becomes P)

    2020-06-03T08:30:28+00:00 – [DD] Processing job 3 of 4 with id <j-pa7qsx> and status <NEW>
    2020-06-03T08:30:28+00:00 – [DD] Found NEW job with local ID <j-pa7qsx>, starting its queue processing
    2020-06-03T08:30:28+00:00 – [DD] Job id <j-pa7qsx> with hash <dd491970c1081599b0a93094fcd56f19> has no rule yet
    2020-06-03T08:30:43+00:00 – [DD] criticalcss.com: POST generate request body is {“url”:”https:\/\/willstocks.co.uk\/offline\/”,”aff”:1,”aocssv”:”AO_2.7.2″}
    2020-06-03T08:30:43+00:00 – [DD] criticalcss.com: POST generate request for path <https://willstocks.co.uk/offline/&gt; replied successfully
    2020-06-03T08:30:43+00:00 – [DD] Job id <j-pa7qsx> generate request successful, remote id <50132499xvM31emC5M>, status now is <JOB_ONGOING>
    2020-06-03T08:30:43+00:00 – [DD] Queue updated by job id <j-pa7qsx>

    3. P job processed, resulting CCSS fetched from criticalcss.com, rule created

    2020-06-03T08:40:24+00:00 – [DD] Processing job 1 of 2 with id <j-pa7qsx> and
    status <JOB_ONGOING>
    2020-06-03T08:40:24+00:00 – [DD] Found PENDING job with local ID <j-pa7qsx>, continuing its queue processing
    2020-06-03T08:40:24+00:00 – [DD] criticalcss.com: GET results request for remote job id <50132499xvM31emC5M> replied successfully
    2020-06-03T08:40:24+00:00 – [DD] Critical CSS file for the rule <paths|/offline/> was saved as <ccss_4e9d61528ad0a92f786174081d67e0de_R.css>, size in bytes is <15985>
    2020-06-03T08:40:24+00:00 – [DD] Job id <j-pa7qsx> result request successful, remote id <50132499xvM31emC5M>, status <JOB_DONE, file saved <ccss_4e9d61528ad0a92f786174081d67e0de_R.css> but requires REVIEW
    2020-06-03T08:40:24+00:00 – [DD] Job id <j-pa7qsx> is DONE and was removed from the queue
    2020-06-03T08:40:24+00:00 – [DD] Queue updated by job id <j-pa7qsx>
    2020-06-03T08:40:24+00:00 – [DD] Target rule <paths|/offline/> of type <AUTO> was CREATED for job id <j-pa7qsx>
    2020-06-03T08:40:24+00:00 – [DD] Job id <j-pa7qsx> updated the target rule <paths|/offline/>

    Thread Starter Will Stocks

    (@willstockstech)

    Must’ve been the maintenance job πŸ™

    So, is there something that defines _which_ N jobs are actually passed off to ccss.com for generation? If it’s not _all_ N jobs in the queue, how are the jobs selected?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thread Starter Will Stocks

    (@willstockstech)

    Aha!!!

    OK I see now (I think anyway… a good chunk of the code is beyond my skillset but thankfully commented so I think I’m with you!) – so looking at the debug data, it looks like all my is_single‘s get the same hash value and therefore only one of them gets passed off (initially) to ccss.com for generation (I assume because the logic is that all is_single pages will be essentially identical above-the-fold?), rather than sending every single page off for generation and then having to apply the logic of comparing and combining the responses of all into a single file?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    for each conditional tags (e.g. is_single) one rule is created. the only exception is is_page, which is ignored and path-based rules are created for those (given the fact pages can be _very_ different).

    Thread Starter Will Stocks

    (@willstockstech)

    Cool, that all makes sense!

    So, in terms of generation, do I just need to keep an eye on which page is used to generate the is_single ccss and then manually apply the styles for pages that are slightly different?

    As an example, I have two post layouts – “normal” and “featured” is probably the best way to describe them. They have _slightly_ different above-the-fold layouts:

    “Normal”: https://willstocks.co.uk/replacing-my-mouse-for-a-graphics-tablet/
    “Featured”: https://willstocks.co.uk/review-obins-anne-pro-2/

    Probably a bit of an edge-case, but ya know πŸ˜‰

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    if one of the two is an exception and the other normal behavior for posts (is_single), then I would make a manual rule for the exception (either PATH or conditional tag template based). But if you have a lot of differences in posts, I can provide you with a code snippet that will instruct AO to generate PATH-based rules for is_single as well πŸ™‚

    Thread Starter Will Stocks

    (@willstockstech)

    The “Featured” is definitely the exception, but it’s entirely dependent on which post out of the queue is picked to pass to ccss (I assume it’s whatever is first in the list?) therefore either one could be picked for ccss generation and then the other becomes the exception?

    If you could send the snippet, I’ll carve out some time to trial it and see how it works!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    but does “featured” have it’s own template or CPT? because it might be easier to just make one manual rule for that instead of creating a huge amount of path-based rules for all blogposts?

Viewing 12 replies - 16 through 27 (of 27 total)
  • The topic ‘Critical CSS Plugin’ is closed to new replies.