Skip to content

Commit

Permalink
fixed getAdvancedStats when index not yet ready
Browse files Browse the repository at this point in the history
  • Loading branch information
massimocandela committed Mar 26, 2024
1 parent 614cc33 commit 7afb1f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/connectors/PacketVisConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default class PacketVisConnector extends RpkiClientConnector {
}

getExpiringElements = (vrp, expires, now) => {
if (this.metaIndex) {
return Promise.resolve(this.metaIndex.getExpiring(vrp, expires, now));
if (this.index) {
return Promise.resolve(this.index.getExpiring(vrp, expires, now));
} else {
const url = brembo.build(this.vrpHost, {
path: ["meta", "expiring"],
Expand Down
8 changes: 4 additions & 4 deletions src/connectors/RpkiClientConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ export default class RpkiClientConnector extends Connector {
getAdvancedStats = () => {
if (!this.setAdvancedStatsTimer) {
this.setAdvancedStatsTimer = setInterval(this._setAdvancedStats, this.advancedStatsRefreshRateMinutes * 60 * 1000);
this._setAdvancedStats();
this._advancedStatsPromise = this._setAdvancedStats();
}

if (this.index) {
return Promise.resolve(this.index);
} else {
return Promise.reject("Index not ready");
return this._advancedStatsPromise
.then(() => this.index)
}
}

Expand Down Expand Up @@ -64,8 +65,7 @@ export default class RpkiClientConnector extends Connector {
}
}
}
})
.catch(() => {});
});
};

_applyRpkiClientMetadata = (metadata={}) => {
Expand Down

0 comments on commit 7afb1f9

Please sign in to comment.