using a higher AJAX timeout

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
mhstar89
Posts: 5
Joined: Sun Dec 17, 2017 2:48 pm

using a higher AJAX timeout

Post by mhstar89 »

Hey guys,

Is it possible somehow to specify a timeout for the AJAX requests?
Especially with a bunch of events, I manage to get into a state where I cannot review *any* events, even though the server reply comes fine (just a bit too late apparently). The AJAX request fails with "timeout" then, gets repeated, just to fail with a "timeout" again and again and again (as long as you let it run).

I can hack a fix right into the /var/cache/zoneminder/cache/skins_classic_views_js_events-dark-1649113633.js file, which immediately solves my issue:

Instead of the line

Code: Select all

$j.getJSON(thisUrl + '?view=request&request=events&task=query'+filterQuery, params.data)
I write

Code: Select all

$j.ajax({
    dataType: "json",
    url: thisUrl + '?view=request&request=events&task=query'+filterQuery,
    data: params.data,
    timeout: 50000
})
Everything else (including the done/fail callbacks) remains the same.

Is there a better way of doing it, or can this change find its way into mainstream? Because without the change, Zoneminder is pretty much unusable for me on this installation (because I cannot review any events), whereas with the change everything is fine.
Since getJSON is a shorthand for the ajax call I do, and I just also specify the timeout, this shouldn't break anything.

Thanks,
Michael
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: using a higher AJAX timeout

Post by knight-of-ni »

Ajax timeout is found under the bandwidth options
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Post Reply