Jump to content

Site gets high boot time


Gideon So
 Share

Recommended Posts

3 minutes ago, Gideon So said:

Hi @adrian,

It is TinyPNG Image Compression.

Gideon

Are you using a module that has already been posted here, or your own custom one?

I am curious if the slow response is only the first time a page is loaded? I feel like the module should be able to cache compressed versions and only ever have to run the call to the service once.

  • Like 1
Link to comment
Share on other sites

13 minutes ago, Gideon So said:

Hi @adrian,

It slows down every page load even I made a blank page doing nothing. I found that this module increases the ProcessWire boot time by increasing boot.autoload time.

Gideon

 

Any chance you could point us to the module code?

  • Like 1
Link to comment
Share on other sites

3 hours ago, Gideon So said:

Hi adrian,

Here you are. 

https://github.com/BlowbackDesign/TinyPNG

Gideon

Seems like the main problem is that the setKeyAndValidate() method is called on every PW ready(). I just commented that out and load times go back to being normal.

I don't know the Tiny API, but I would think it would be possible to either just do this once, the first time the API key is entered, or perhaps if it's needed for each call to Tiny, then it could be called only when one of the hooks is triggered.

Perhaps @Roope can take a better look since it's his module.

  • Like 3
Link to comment
Share on other sites

Hi Adrian,

Thanks for the fast investigation into the problem. 

This is from their document:

Quote

If you are writing code that uses an API key configured by your users, you may want to validate the API key before attempting to compress images.

But I don't think it is not necessary to check the key every page load.

Gideon

Link to comment
Share on other sites

  • 4 months later...
On 8/9/2017 at 8:49 AM, adrian said:

Seems like the main problem is that the setKeyAndValidate() method is called on every PW ready(). I just commented that out and load times go back to being normal.

I don't know the Tiny API, but I would think it would be possible to either just do this once, the first time the API key is entered, or perhaps if it's needed for each call to Tiny, then it could be called only when one of the hooks is triggered.

Perhaps @Roope can take a better look since it's his module.

 

On 8/9/2017 at 11:21 AM, Gideon So said:

Hi Adrian,

Thanks for the fast investigation into the problem. 

This is from their document:

But I don't think it is not necessary to check the key every page load.

Gideon

 

Hi all!

Sorry I'm little late for the party. Key validation on every page load is surely not necessary and it was just a simple stupidity be set like that. It's fixed now and I just pushed it to github. Thanks for the notice! (not been using the module after couple of tryouts)

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...