Fix AS detail view to show unique prefixes
- Update GetASDetails query to GROUP BY prefix instead of using DISTINCT - Use MAX(last_updated) to get the most recent update time for each prefix - This prevents duplicate prefixes from appearing when announced by multiple peers - Maintains the same prefix count and ordering
This commit is contained in:
parent
df31cf880a
commit
48db8b9edf
@ -767,11 +767,12 @@ func (d *Database) GetASDetails(asn int) (*ASN, []LiveRoute, error) {
|
||||
asnInfo.Handle = handle.String
|
||||
asnInfo.Description = description.String
|
||||
|
||||
// Get prefixes announced by this AS
|
||||
// Get prefixes announced by this AS (unique prefixes with most recent update)
|
||||
query := `
|
||||
SELECT DISTINCT prefix, mask_length, ip_version, last_updated
|
||||
SELECT prefix, mask_length, ip_version, MAX(last_updated) as last_updated
|
||||
FROM live_routes
|
||||
WHERE origin_asn = ?
|
||||
GROUP BY prefix, mask_length, ip_version
|
||||
ORDER BY ip_version, mask_length, prefix
|
||||
`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user