mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix: keep each aircraft feed's freshness in search answers
find_aircraft merged the records of the feeds that answered and dropped their freshness, so a stale OpenSky snapshot read as a current "not reported". Answers now list each feed with its freshness and coverage and say which feed's data may be stale.
This commit is contained in:
1 parent
41d1352930
commit
33445aec73
2 files changed
+55
-1
No files matched your search
@@ -201,6 +201,15 @@ export const findAircraft = defineTool({
|
||||
)
|
||||
.filter((record) => !seen.has(record.id) && seen.add(record.id))
|
||||
.map((record) => aircraftRow(record));
|
||||
// Each feed that answered, with its own freshness and coverage.
|
||||
const answered = feeds.flatMap(({ name }, index) =>
|
||||
settled[index].status === 'fulfilled'
|
||||
? [{ feed: name, ...snapshotInfo(settled[index].value) }]
|
||||
: [],
|
||||
);
|
||||
const stale = answered
|
||||
.filter((feed) => feed.freshness === 'stale')
|
||||
.map((feed) => feed.feed);
|
||||
return {
|
||||
summary:
|
||||
(rows.length
|
||||
@@ -208,8 +217,16 @@ export const findAircraft = defineTool({
|
||||
: `No aircraft with ${key} ${wanted} is currently reported.`) +
|
||||
(unavailable.length
|
||||
? ` The ${unavailable.join(' and ')} feed did not answer.`
|
||||
: '') +
|
||||
(stale.length
|
||||
? ` The ${stale.join(' and ')} feed data may be stale.`
|
||||
: ''),
|
||||
data: { ...capRows(rows, args.limit), unavailable_feeds: unavailable },
|
||||
data: {
|
||||
...capRows(rows, args.limit),
|
||||
unavailable_feeds: unavailable,
|
||||
stale_feeds: stale,
|
||||
feeds: answered,
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user