Skip to content

Commit

Permalink
Added logging for when Flightaware has nothing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Prickett committed Apr 12, 2023
1 parent 3a9c631 commit 474a7a4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions enricher/enricher.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ while (true) {

if (flightAwareResponse.status === 200) {
const flightData = await flightAwareResponse.json();
let updatedFlight = false;

for (const flight of flightData.flights) {
// The response contains an array of recent past, current and
Expand Down Expand Up @@ -78,9 +79,14 @@ while (true) {
console.log(`Saving details to ${flightKey}...`);
console.log(flightDetails);
redisClient.hSet(flightKey, flightDetails);
updatedFlight = true;
}
}

if (! updatedFlight) {
console.log(`FlightAware has nothing in flight for ${msgPayload.hex_ident} / ${msgPayload.callsign} right now.`);
}

} else {
console.log(`Error: FlightAware API returned ${flightAwareResponse.status} code.`);
}
Expand Down

0 comments on commit 474a7a4

Please sign in to comment.