_flushEventsFromDisk()

in packages/@fbcmobile-ui/Logging/UserActionLogger.js [201:220]


  _flushEventsFromDisk() {
    this._getLogEvents().then((events: Array<string>) => {
      const eventsThatFailedToUpload = [];
      events.forEach(event => {
        this._fetchParams.body = event;
        fetch(this._baseUrl, this._fetchParams)
          .then(_response => {
            // noop - the service returns an empty response when logs are received
          })
          .catch((_error: Error) => {
            // store events that failed to upload so we can try to upload them again later
            eventsThatFailedToUpload.push(event);
          });
      });
      this._setLogEvent(null); // clear out the disk cache
      if (eventsThatFailedToUpload.length > 0) {
        this._setLogEvents(eventsThatFailedToUpload);
      }
    });
  }