Jump to content

Shipping module vs execution time


Sonriente

Recommended Posts

Hello.

 

I've developed a shipping module that works fine except the execution time.

When the module is enabled the cart/checkout pages are loaded up to 20-30 seconds.

The module communicates with 3-d party API, but the average execution time of the code that communicates with external service is 0.5-1.5 sec. So, there is no any problems with the external service.

I've performed an investigation and found the following:

The problem is caused by the fact the getOrderShippingCost function is called several times (randomly, from 2 to 10) during the loading of the cart page.

I don't understand why it is executed several times and how to avoid this issue. Is it a bug in my code or bug in Prestashop?

The backtrace is attached to this message.

 

Any ideas will be appreciated greatly.

Link to comment
Share on other sites

  • 4 years later...

Hi there,

 

I'm running into the same issue. In fact, the method in our module is being called 4 times. Anyone found any solution or explanation why this happens and how to avoid the multiple-calls?

 

We're thinking about placing time counters or any other kind of similar system, but of course it's not a good practice.

 

Regards!

 

Marcos

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
×
×
  • Create New...