You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by bu...@apache.org on 2012/04/07 21:31:00 UTC

svn commit: r811866 - in /websites/staging/ooo-site/trunk: cgi-bin/ content/ content/download/test/download_new_dl.js content/download/test/globalvars_new_dl.js content/download/test/index_new_dl.html

Author: buildbot
Date: Sat Apr  7 19:30:59 2012
New Revision: 811866

Log:
Staging update by buildbot for openofficeorg

Modified:
    websites/staging/ooo-site/trunk/cgi-bin/   (props changed)
    websites/staging/ooo-site/trunk/content/   (props changed)
    websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js
    websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js
    websites/staging/ooo-site/trunk/content/download/test/index_new_dl.html

Propchange: websites/staging/ooo-site/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Apr  7 19:30:59 2012
@@ -1 +1 @@
-1310806
+1310832

Propchange: websites/staging/ooo-site/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Apr  7 19:30:59 2012
@@ -1 +1 @@
-1310806
+1310832

Modified: websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js
==============================================================================
--- websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js (original)
+++ websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js Sat Apr  7 19:30:59 2012
@@ -28,7 +28,7 @@ function getMirrorHost() {
 		}
 	}
 
-	document.write( "Regular download goes to: " + mirrorHost + "<br/><br/>" );
+	document.write( "Regular download goes to: " + mirrorHost + "<br/>" );
 
 	// Defining fall back mirror host
 	if ( mirrorHost == "" ) {
@@ -51,7 +51,7 @@ function getMirrorHost() {
 	return mirrorHost;
 }
 
-function getMirrorHost_asf_sf_mb() {
+function getMirrorHost_asf_sf_mb_percent() {
 	var mirrorHost = "";
 	var randVal    = ( Math.random() * 100 );
 	var MIRROR_RATIO = MIRROR_RATIO_2;
@@ -77,14 +77,83 @@ function getMirrorHost_asf_sf_mb() {
 		}
 	}
 
-	// Are Mirrorbrain mirrors working?
+	// Are MirrorBrain mirrors working?
 	if ( MIRROR_MB_ACTIVE > 0 ) {
 		// If random value is higher than ratio * 2
         	if ( randVal > ( MIRROR_RATIO * 2 ) ) {
 			mirrorHost = "MirrorBrain";
 		}
 	}
-	document.write( "Regular download goes to: " + mirrorHost + "<br/><br/>" );
+	document.write( "Regular download goes to: " + mirrorHost + "<br/>" );
+
+	// Defining fall back mirror host
+	if ( mirrorHost == "" ) {
+		// Are Apache mirrors working?
+		if ( MIRROR_ASF_ACTIVE > 0 ) {
+			mirrorHost = "Apache";
+
+		// Else are SourceForge mirrors working?
+		} else if ( MIRROR_SF_ACTIVE > 0 ) {
+			mirrorHost = "SourceForge";
+
+		// Else are MirrorBrain mirrors working?
+		} else if ( MIRROR_MB_ACTIVE > 0 ) {
+			mirrorHost = "MirrorBrain";
+
+		// None is working, we have a problem
+		} else {
+			mirrorHost = "None, what to do?";
+		}
+
+		document.write( "Fall back download goes to: " + mirrorHost + "<br/><br/>" );
+	}
+
+	return mirrorHost;
+}
+
+function getMirrorHost_asf_sf_mb_weighted() {
+	var mirrorHost = "";
+	var weight     = MIRROR_ASF_WEIGHT + MIRROR_MB_WEIGHT + MIRROR_SF_WEIGHT;
+	var randVal    = Math.random();
+
+	document.write( "ASF is active: "  + MIRROR_ASF_ACTIVE              + "<br/>" );
+	document.write( "SF is active: "   + MIRROR_SF_ACTIVE               + "<br/>" );
+	document.write( "MB is active: "   + MIRROR_MB_ACTIVE               + "<br/>" );
+	document.write( "ASF weight: "     + MIRROR_ASF_WEIGHT + " ");
+	document.write( "with threshold: " + ( MIRROR_ASF_WEIGHT / weight ) + "<br/>" );
+	document.write( "MB weight: "      + MIRROR_MB_WEIGHT + " ");
+	document.write( "with threshold: " + ( MIRROR_MB_WEIGHT / weight )  + "<br/>" );
+	document.write( "SF weight: "      + MIRROR_SF_WEIGHT + " ");
+	document.write( "with threshold: " + ( MIRROR_SF_WEIGHT / weight )  + "<br/>" );
+	document.write( "Total weight: "   + weight                         + "<br/>" );
+	document.write( "Random value: "   + randVal                        + "<br/>" );
+	document.write( "<br/>" );
+
+	// Are Apache mirrors working?
+	if ( MIRROR_ASF_ACTIVE > 0 ) {
+		// If random value is lower than ASF weight divided by total weight
+        	if ( randVal < ( MIRROR_ASF_WEIGHT / weight ) ) {
+			mirrorHost = "Apache";
+		}
+	}
+
+	// Are MirrorBrain mirrors working?
+	if ( MIRROR_MB_ACTIVE > 0 ) {
+	// If random value is lower than SF weight divided by the total weight
+	// and higher than ASF weight divided by the total weight
+		if ( randVal < ( MIRROR_SF_WEIGHT / weight ) && ( randVal > ( MIRROR_ASF_WEIGHT / weight ) )) {
+			mirrorHost = "MirrorBrain";
+		}
+	}
+
+	// Are SourceForge mirrors working?
+	if ( MIRROR_SF_ACTIVE > 0 ) {
+		// If random value is higher than MB weight divided by total weight
+        	if ( randVal > ( MIRROR_MB_WEIGHT / weight ) ) {
+			mirrorHost = "SourceForge";
+		}
+	}
+	document.write( "Regular download goes to: " + mirrorHost + "<br/>" );
 
 	// Defining fall back mirror host
 	if ( mirrorHost == "" ) {

Modified: websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js
==============================================================================
--- websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js (original)
+++ websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js Sat Apr  7 19:30:59 2012
@@ -15,11 +15,14 @@
 
 // The supported mirror hosts, 0 means not ready to receive load
 // The mirror ratio in percent
-var MIRROR_ASF_ACTIVE = 0;
+var MIRROR_ASF_ACTIVE = 1;
 var MIRROR_SF_ACTIVE  = 1;
 var MIRROR_MB_ACTIVE  = 1;
 var MIRROR_RATIO_1    = 75;
 var MIRROR_RATIO_2    = 33;
+var MIRROR_ASF_WEIGHT = 1;
+var MIRROR_MB_WEIGHT  = 2;
+var MIRROR_SF_WEIGHT  = 3;
 
 // Exchange the variables resp. its content to switch the MirrorBrain server
 var MIRROR_BOUNCER_URL      = "http://openoffice.bouncer.osuosl.org/";

Modified: websites/staging/ooo-site/trunk/content/download/test/index_new_dl.html
==============================================================================
--- websites/staging/ooo-site/trunk/content/download/test/index_new_dl.html (original)
+++ websites/staging/ooo-site/trunk/content/download/test/index_new_dl.html Sat Apr  7 19:30:59 2012
@@ -29,13 +29,17 @@
   <script type="text/javascript">
   <!--
   document.write ( "<h2>This page is to test how to get download requests to more than one mirror hosts:</h2>" );
-  document.write ( "<h3>1. Mirror hosts are: Apache, SourceForge</h3>" );
+  document.write ( "<h3>1. Mirror redirection by percent: Apache, SourceForge</h3>" );
 
   getMirrorHost();
 
-  document.write ( "<h3>2. Mirror hosts are: Apache, SourceForge, MirrorBrain</h3>" );
+  document.write ( "<h3>2. Mirror redirection by percent: Apache, SourceForge, MirrorBrain</h3>" );
 
-  getMirrorHost_asf_sf_mb();
+  getMirrorHost_asf_sf_mb_percent();
+
+  document.write ( "<h3>3. Mirror redirection by weight: Apache, SourceForge, MirrorBrain</h3>" );
+
+  getMirrorHost_asf_sf_mb_weighted();
 
   //-->
   </script>