private _cleanUpCurrentGeohashesQueried()

in packages/geofire/src/GeoQuery.ts [330:361]


  private _cleanUpCurrentGeohashesQueried(): void {
    let keys: string[] = Object.keys(this._currentGeohashesQueried);
    keys.forEach((geohashQueryStr: string) => {
      const queryState: any = this._currentGeohashesQueried[geohashQueryStr];
      if (queryState.active === false) {
        const query = this._stringToQuery(geohashQueryStr);
        // Delete the geohash since it should no longer be queried
        this._cancelGeohashQuery(query, queryState);
        delete this._currentGeohashesQueried[geohashQueryStr];
      }
    });

    // Delete each location which should no longer be queried
    keys = Object.keys(this._locationsTracked);
    keys.forEach((key: string) => {
      if (!this._geohashInSomeQuery(this._locationsTracked[key].geohash)) {
        if (this._locationsTracked[key].isInQuery) {
          throw new Error('Internal State error, trying to remove location that is still in query');
        }
        delete this._locationsTracked[key];
      }
    });

    // Specify that this is done cleaning up the current geohashes queried
    this._geohashCleanupScheduled = false;

    // Cancel any outstanding scheduled cleanup
    if (this._cleanUpCurrentGeohashesQueriedTimeout !== null) {
      clearTimeout(this._cleanUpCurrentGeohashesQueriedTimeout);
      this._cleanUpCurrentGeohashesQueriedTimeout = null;
    }
  }