Skip to content

Commit

Permalink
🐛 Fix exiting before publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
pvillaverde committed May 22, 2024
1 parent f13415f commit 7eea170
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dev/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function sendMessage() {
const message = {
id: id
}
mqttService.publish("test", JSON.stringify(message), { qos: 2 });
await mqttService.publishAsync("test", JSON.stringify(message), { qos: 2 });
/* logger.info(`Publishing to MQTT topic "test"`, JSON.stringify(message)); */
sendMessage();
}
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/refreshBlogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default async function refreshBlogs() {
entryLink: entry.link,
};
logger.debug(`Publishing to MQTT topic "${mqttConfig.MQTT_TOPIC}"`, JSON.stringify(message));
mqttService.publish(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
await mqttService.publishAsync(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
}
}
logger.info(`${index + 1}/${blogs.length}`, `Recuperadas ${entries.length} entradas de ${item.title}.`);
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/refreshPodcasts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default async function refreshPodcasts() {
entryLink: entry.link,
};
logger.debug(`Publishing to MQTT topic "${mqttConfig.MQTT_TOPIC}"`, JSON.stringify(message));
mqttService.publish(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
await mqttService.publishAsync(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
}
}
logger.info(`${index + 1}/${podcasts.length}`, `Recuperados ${entries.length} episodios de ${item.title}.`);
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/refreshTwitchStreams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default async function refreshTwitchStreams() {
channel: channel,
game: game,
};
mqttService.publish(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
await mqttService.publishAsync(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
}
mqttService.end();
Deno.exit(0);
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/refreshYoutube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default async function refreshYoutube() {
entryLink: entry.link,
};
logger.debug(`Publishing to MQTT topic "${mqttConfig.MQTT_TOPIC}"`, JSON.stringify(message));
mqttService.publish(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
await mqttService.publishAsync(mqttConfig.MQTT_TOPIC, JSON.stringify(message), { qos: 2 });
}
}
logger.info(
Expand Down

0 comments on commit 7eea170

Please sign in to comment.