Bug 1542100 - Only enable BITS update for 50% of eligible population r=rstrong
authorKirk Steuber <ksteuber@mozilla.com>
Tue, 23 Apr 2019 17:18:07 +0000
changeset 470568 30ed3b129f01e715bb12f91a7c11d6794d89601c
parent 470567 19fc231ad8d7763370dcb8766c5e0883e669a49c
child 470569 179c0370dfa12b59d2214509d41a8356962f5df7
push id35908
push useraciure@mozilla.com
push dateWed, 24 Apr 2019 04:28:40 +0000
treeherdermozilla-central@c9f0730a57a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstrong
bugs1542100
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1542100 - Only enable BITS update for 50% of eligible population r=rstrong Differential Revision: https://phabricator.services.mozilla.com/D28368
toolkit/mozapps/update/UpdateService.jsm
--- a/toolkit/mozapps/update/UpdateService.jsm
+++ b/toolkit/mozapps/update/UpdateService.jsm
@@ -28,16 +28,17 @@ XPCOMUtils.defineLazyModuleGetters(this,
 });
 
 const UPDATESERVICE_CID = Components.ID("{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}");
 
 const PREF_APP_UPDATE_ALTWINDOWTYPE        = "app.update.altwindowtype";
 const PREF_APP_UPDATE_BACKGROUNDERRORS     = "app.update.backgroundErrors";
 const PREF_APP_UPDATE_BACKGROUNDMAXERRORS  = "app.update.backgroundMaxErrors";
 const PREF_APP_UPDATE_BITS_ENABLED         = "app.update.BITS.enabled";
+const PREF_APP_UPDATE_BITS_INTRIALGROUP    = "app.update.BITS.inTrialGroup";
 const PREF_APP_UPDATE_CANCELATIONS         = "app.update.cancelations";
 const PREF_APP_UPDATE_CANCELATIONS_OSX     = "app.update.cancelations.osx";
 const PREF_APP_UPDATE_CANCELATIONS_OSX_MAX = "app.update.cancelations.osx.max";
 const PREF_APP_UPDATE_DOORHANGER           = "app.update.doorhanger";
 const PREF_APP_UPDATE_DOWNLOAD_ATTEMPTS    = "app.update.download.attempts";
 const PREF_APP_UPDATE_DOWNLOAD_MAXATTEMPTS = "app.update.download.maxAttempts";
 const PREF_APP_UPDATE_ELEVATE_NEVER        = "app.update.elevate.never";
 const PREF_APP_UPDATE_ELEVATE_VERSION      = "app.update.elevate.version";
@@ -576,16 +577,30 @@ function getCanUseBits() {
   if (AppConstants.platform != "win") {
     LOG("getCanUseBits - Not using BITS because this is not Windows");
     return "NoBits_NotWindows";
   }
   if (!AppConstants.MOZ_BITS_DOWNLOAD) {
     LOG("getCanUseBits - Not using BITS because the feature is disabled");
     return "NoBits_FeatureOff";
   }
+
+  // By default, enable BITS for 50% of the eligible population (Bug 1542100)
+  let inTrialGroup;
+  if (Services.prefs.getPrefType(PREF_APP_UPDATE_BITS_INTRIALGROUP) ==
+      Services.prefs.PREF_INVALID) {
+    inTrialGroup = (Math.floor(Math.random() * 2) == 1);
+    Services.prefs.setBoolPref(PREF_APP_UPDATE_BITS_INTRIALGROUP, inTrialGroup);
+  } else {
+    inTrialGroup = Services.prefs.getBoolPref(PREF_APP_UPDATE_BITS_INTRIALGROUP,
+                                              false);
+  }
+  let defaultPrefs = Services.prefs.getDefaultBranch("");
+  defaultPrefs.setBoolPref(PREF_APP_UPDATE_BITS_ENABLED, inTrialGroup);
+
   if (!Services.prefs.getBoolPref(PREF_APP_UPDATE_BITS_ENABLED, true)) {
     LOG("getCanUseBits - Not using BITS. Disabled by pref.");
     return "NoBits_Pref";
   }
   if (gBITSInUseByAnotherUser) {
     LOG("getCanUseBits - Not using BITS. Already in use by another user");
     return "NoBits_OtherUser";
   }