jsgui: Double check server is standby when redirecting

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/8b88a808
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/8b88a808
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/8b88a808

Branch: refs/heads/master
Commit: 8b88a8080f984a422412fc162d31310c343c3f26
Parents: b30e150
Author: Sam Corbett <sam.corb...@cloudsoftcorp.com>
Authored: Tue Jun 3 11:07:48 2014 +0100
Committer: Sam Corbett <sam.corb...@cloudsoftcorp.com>
Committed: Tue Jun 3 11:07:48 2014 +0100

----------------------------------------------------------------------
 usage/jsgui/src/main/webapp/assets/js/router.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8b88a808/usage/jsgui/src/main/webapp/assets/js/router.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/router.js 
b/usage/jsgui/src/main/webapp/assets/js/router.js
index 573a703..ad17fd7 100644
--- a/usage/jsgui/src/main/webapp/assets/js/router.js
+++ b/usage/jsgui/src/main/webapp/assets/js/router.js
@@ -183,7 +183,10 @@ define([
                     this.scheduledRedirect = true;
                     console.log("Redirecting to " + destination + " in " + 
time + " seconds");
                     setTimeout(function () {
-                        window.location.href = destination;
+                        // re-check, in case the server's status changed in 
the wait
+                        if (!ha.isMaster()) {
+                            window.location.href = destination;
+                        }
                     }, time * 1000);
                 }
             } else {

Reply via email to