async _update()

in zuul-status/zuul-status.js [130:159]


  async _update() {
    try {
      let response = await this.getZuulStatus(this.change, this.revision);
      response = response.map((results, i) => {
        if (!results || typeof results.jobs[i] === 'undefined')
          return;

        return {
          name: results.jobs[i].pipeline,
          results,
        };
      });

      // We remove undefined keys from the object
      Object.keys(response).forEach(key => {
       if (response && typeof response[key] === 'undefined')
          delete response[key];
      });

      this._response = response;

      this._updateIntervalMs = DEFAULT_UPDATE_INTERVAL_MS;
    } catch (err) {
      this._updateIntervalMs = Math.min(
          MAX_UPDATE_INTERVAL_MS,
          (1 + Math.random()) * this._updateIntervalMs * 2);
      console.warn(err);
    }
    this._resetTimeout();
  }