Skip Navigation

[Resolved] Show results within X km times out

This support ticket is created 5 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 7 replies, has 2 voices.

Last updated by davidS-53 5 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#1240182

I have a number of usability issues with the maps plugin. I'm trying to build a simple stockist finder. I have approximately 400 stockists currently, set up as a CPT with an address field.

Halfway down this page (hidden link) you'll find a map that's set up and working for the most part.

My issues are this:

1) How many markers should I be able to display on the map? Attempting to display them all causes the website to timeout.

2) If there is a limit to how many can be displayed, how do I ensure that the stockists displayed are the closest ones to the user? I can set an initial distance filter, but in bigger cities with a large number of stockists, we'd be talking 30+ stockists, which appears to cause the site to timeout so this isn't possible.

3) When searching by distance (Show results within X km of location) the website times out.

What am I doing wrong? These things seem like they should be pretty basic considering the simplicity of my setup.

Cheers.

#1240240

Hi David,

Thank you for contacting us and I'll be happy to assist.

I tried to log in to your website's admin area, but the username or the password didn't work.
( it kept showing the message: "ERROR: The username or password you entered is incorrect." )

There is no hard and fast rule or limit on how many map markers can be shown on a map. But it is important to note that the map and address field operations are resource intensive and timeout errors suggest that currently the server's allocated resources or allowed time for execution is not enough.

Your website's debug information, shows that currently the "max_execution_time" option in PHP is set to "60", which is fairly low. Can you please increase it to a higher value e.g. 600 and then check the map markers and the search again?
( you can consult your hosting support team if you face difficulty in increasing this value )

Here is a useful guide on troubleshooting the server's timeout errors, in general:
hidden link

In case the timeout errors still persist, please turn on WordPress debugging and share any errors or warnings which are shown on the screen or in the server's error log.
( ref: https://codex.wordpress.org/Debugging_in_WordPress )

I hope this helps and please let me know how it goes.

regards,
Waqar

#1240278

Hi Waqar,

Thanks for getting back to me. I had forgotten to save your password sorry, that login will work now.

I've increased max_execution_time as you suggested.

If I try to load all stockists, the site still crashes. I seem to be able to load 50 fine.

However, points 2 and 3 above still apply.

How do I display the stockists closest to the user? At the moment you'll note the map loads 50 stockists. This is bad UX-wise, because the implication is that there are no stockists in the other half of the country. I assume this has come up before- do you have any suggestions to get around this? Perhaps load the map with no markers, then only load the closest markers to the user?

That leads me to the next problem- when I try to search within 100km of my current location, the site times out again?

#1240768

Hi David,

Thanks for writing back.

>> How do I display the stockists closest to the user? At the moment you'll note the map
>> loads 50 stockists. This is bad UX-wise, because the implication is that there are no
>> stockists in the other half of the country. I assume this has come up before- do you have
>> any suggestions to get around this? Perhaps load the map with no markers, then only
>> load the closest markers to the user?

- I've performed a few tests on my website and can confirm that the way "distance" query filter works in Views, it can be set to
show the closest markers, based on the visitor's location, by selecting the option "Distance center is set from user location."
( screenshot: hidden link )

But, the downside of this would be that the visitor loses the ability to change the search filter from the front-end.
( screenshot: hidden link )

If you'd like to offer both these functionalities, perhaps you can create a duplicate of your view and use one of them for the visitor's location filter and the other one for the filter that is adjustable from the front-end.
( but it would be a good idea to offer them on separate pages, to avoid performance/timeout issues )

You're welcome to submit a feature request to add support for both these filters to work from a single view:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

For the timeout issue, It is important to remember that they occur when the server is unable to complete the requested operations successfully in the allowed time.

Did you turn on the debugging mode and checked the server's error logs, as suggested in my last reply? You can also try further increasing the allowed PHP memory size and max execution time to improve this.

regards,
Waqar

#1241273

Hi Waqar, ok, initially displaying the closest 20 items will work fine. I've changed the filtering accordingly.

Yep, debugging enabled. Here's the error from my server log:
[Thu May 09 12:26:39.187570 2019] [proxy_fcgi:error] [pid 65] (70007)The timeout specified has expired: [client ***.***.***.***:*****] AH01075: Error dispatching request to : (polling), referer: hidden link

And an unrelated (I think) error from wordpress debug log:
[08-May-2019 23:26:55 UTC] PHP Notice: Undefined index: hook_suffix in /container/application/public/wp-admin/includes/class-wp-screen.php on line 213

Yep, I've increased resources as follows:
max_execution_time = 1200
max_input_time = 1200
memory_limit = 1024M

Our server has 8 Cores/16GB RAM assigned to it and is pretty premium so I'm struggling to work out where the issue is here... Any further thoughts?

#1241602

Hi David,

Can you please provide the clone/snapshot of your website, as explained in this guide:
https://toolset.com/faq/provide-supporters-copy-site/

This will allow me to troubleshoot this timeout issue, in more depth on my own server.

I've set your next reply as private.

regards,
Waqar

#1241948
#1242206

Hi David,

Thank you for sharing the duplicator package.

I performed some tests on your website's clone, with the same PHP resource settings as you mentioned, but couldn't reproduce the timeout issues.

I duplicated your website's view "Homepage View Stockists" and set it to show all results (319) without any limit and the page loaded fine every time.

Here is a screencast of all locations test:
hidden link

Likewise, I also performed a distance search for "New Zealand" as a central location, since it has the most results and that also worked as expected.

Screencast of search results test:
hidden link

This suggests that the issue seems to be specific to your website's server/environment. I'll recommend consulting your host to see if there is any middle layer involved like a CDN or proxy.
( ref: hidden link )

Important: Please do let them know about the "The timeout specified has expired: [client ***.***.***.***:*****] AH01075: Error dispatching request to : (polling)" error and they'll be able to fix that.
( ref: hidden link )

Also, make sure that the server is configured to meet the basic requirements listed at:
https://toolset.com/toolset-requirements/

regards,
Waqar

#1242769

Thanks Waqar, I'll get in touch with them to get it sorted.