Bug 1174674 - Always block Telemetry shutdown on pending ping writes. r=gfritzsche
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Fri, 02 Oct 2015 06:35:00 +0200
changeset 266016 b19e47b1b333
parent 266015 5b50080b012b
child 266017 fc2079a6af20
push id15517
push useralessio.placitelli@gmail.com
push dateMon, 05 Oct 2015 17:30:12 +0000
treeherderfx-team@fc2079a6af20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1174674
milestone44.0a1
Bug 1174674 - Always block Telemetry shutdown on pending ping writes. r=gfritzsche
toolkit/components/telemetry/TelemetryStorage.jsm
--- a/toolkit/components/telemetry/TelemetryStorage.jsm
+++ b/toolkit/components/telemetry/TelemetryStorage.jsm
@@ -586,16 +586,22 @@ var TelemetryStorageImpl = {
       });
     }
 
     if (this._removePendingPingsTask) {
       yield this._removePendingPingsTask.catch(ex => {
         this._log.error("shutdown - the pending pings removal task failed", ex);
       });
     }
+
+    // Wait on pending pings still being saved. While OS.File should have shutdown
+    // blockers in place, we a) have seen weird errors being reported that might
+    // indicate a bad shutdown path and b) might have completion handlers hanging
+    // off the save operations that don't expect to be late in shutdown.
+    yield this.promisePendingPingSaves();
   }),
 
   /**
    * Save an archived ping to disk.
    *
    * @param {object} ping The ping data to archive.
    * @return {promise} Promise that is resolved when the ping is successfully archived.
    */