From 8481d77f9b49349b807cb86a34900e6e25106ea8 Mon Sep 17 00:00:00 2001
From: Jared Hancock <gravydish@gmail.com>
Date: Fri, 19 Oct 2018 02:34:55 +0000
Subject: [PATCH] pjax: Set a much higher timeout

Now that pjax has been in osTicket for quite some time, it should be
assumed that requests made with pjax will work and a response can be
waited for. With a very low timeout of two seconds, operations that take
more than two seconds are cancelled via pjax and then re-requested via
normal page load. This has the caveat of running large database queries
twice, since some long-running ones cannot be cancelled by the database
until the first results become available. Therefore, queries which take
a while to find the first record (longer than two seconds) will be run
twice. Ultimately, the user will have to wait at least twice as long as
would ultimately be necessary if the system had just waited for a
response from the pjax request.

This sets the timeout at a more reasonable value of 30. Perhaps
something closer to a minute would be a suitable value? Most users are
probably going to click something before 30 seconds expires if they
expect a response faster. And that can't be easily fixed.
---
 scp/js/scp.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scp/js/scp.js b/scp/js/scp.js
index c83673cd3..2b346edcb 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -1120,7 +1120,7 @@ if ($.support.pjax) {
     if (!$this.hasClass('no-pjax')
         && !$this.closest('.no-pjax').length
         && $this.attr('href').charAt(0) != '#')
-      $.pjax.click(event, {container: $this.data('pjaxContainer') || $('#pjax-container'), timeout: 2000});
+      $.pjax.click(event, {container: $this.data('pjaxContainer') || $('#pjax-container'), timeout: 30000});
   })
 }
 
-- 
GitLab