Skip to content

Commit

Permalink
refactor(amqp): update conditions subtopic
Browse files Browse the repository at this point in the history
  • Loading branch information
Forceh91 committed Dec 5, 2024
1 parent fe18d3a commit 09882a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/eccc/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class CurrentConditions {

// hook up the amqp listener
const { connection, emitter: listener } = listen({
amqp_subtopic: `citypage_weather.xml.${config.primaryLocation.province}.#`,
amqp_subtopic: `*.WXO-DD.citypage_weather.xml.${config.primaryLocation.province}.#`,
});

// handle errors and messages
Expand All @@ -102,7 +102,7 @@ class CurrentConditions {
// make sure its relevant to us
if (!url.includes(`${this._weatherStationID}_e.xml`)) return;

this.fetchConditions();
this.fetchConditions(url);
logger.log("Received new conditions from AMQP at", date);
});

Expand All @@ -112,9 +112,9 @@ class CurrentConditions {
logger.log("Started AMQP conditions listener");
}

private fetchConditions() {
private fetchConditions(url: string = this._apiUrl) {
axios
.get(this._apiUrl)
.get(url)
.then((resp) => {
// parse to weather object
const weather = new Weather(resp.data);
Expand Down

0 comments on commit 09882a6

Please sign in to comment.