From 407601cb26c1290c02c94726ad96e35878e54f4f Mon Sep 17 00:00:00 2001 From: Joachim Krempel Date: Tue, 30 Jan 2018 12:45:31 +0100 Subject: [PATCH 1/3] increase retry delays between toolbarAction ajax calls --- .../Resources/views/Profiler/base_js.html.twig | 3 ++- .../Resources/views/Profiler/toolbar_js.html.twig | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index aac9e3a0d4725..46e5c51b329f0 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -28,6 +28,7 @@ var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); options = options || {}; options.maxTries = options.maxTries || 0; + options.retryDelay = options.retryDelay || 500; xhr.open(options.method || 'GET', url, true); xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.onreadystatechange = function(state) { @@ -39,7 +40,7 @@ setTimeout(function(){ options.maxTries--; request(url, onSuccess, onError, payload, options); - }, 500); + }, options.retryDelay); return null; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index 8df2e844df4dd..9fa0edae63248 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -113,7 +113,7 @@ sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar'); } }, - { maxTries: 5 } + { maxTries: 5, timeoutDelay: 1000 } ); })(); /*]]>*/ From 27b97ceb165826fa6d63aa026b0b42ad4d3000b6 Mon Sep 17 00:00:00 2001 From: Joachim Krempel Date: Tue, 30 Jan 2018 13:00:55 +0100 Subject: [PATCH 2/3] fix option name --- .../Resources/views/Profiler/toolbar_js.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index 9fa0edae63248..b7aa299636b37 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -113,7 +113,7 @@ sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar'); } }, - { maxTries: 5, timeoutDelay: 1000 } + { maxTries: 5, retryDelay: 1000 } ); })(); /*]]>*/ From 16e9222b7165af3b7a34fffec3e05aa31abcd30d Mon Sep 17 00:00:00 2001 From: Joachim Krempel Date: Tue, 30 Jan 2018 16:57:56 +0100 Subject: [PATCH 3/3] hardcode increased timeout value instead of option value --- .../Resources/views/Profiler/base_js.html.twig | 3 +-- .../Resources/views/Profiler/toolbar_js.html.twig | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index 46e5c51b329f0..7b26275ca8907 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -28,7 +28,6 @@ var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); options = options || {}; options.maxTries = options.maxTries || 0; - options.retryDelay = options.retryDelay || 500; xhr.open(options.method || 'GET', url, true); xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.onreadystatechange = function(state) { @@ -40,7 +39,7 @@ setTimeout(function(){ options.maxTries--; request(url, onSuccess, onError, payload, options); - }, options.retryDelay); + }, 1000); return null; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index b7aa299636b37..8df2e844df4dd 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -113,7 +113,7 @@ sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar'); } }, - { maxTries: 5, retryDelay: 1000 } + { maxTries: 5 } ); })(); /*]]>*/