Aircraft age field always shows 0 seconds #3

Closed
opened 2025-08-24 17:56:32 +02:00 by olemd · 0 comments
Owner

Problem Description

The age field in the aircraft API response is always showing 0 seconds, which doesn't make sense as aircraft should show time since their last position update.

Expected Behavior

The age field should show the number of seconds since the aircraft's last update, increasing over time when aircraft haven't sent recent position reports.

Current Behavior

All aircraft consistently show "age": 0 regardless of when they last transmitted.

API Example

{
  "aircraft": {
    "4ACB58": {
      "ICAO24": "4ACB58",
      "Callsign": "SAS827  ",
      "age": 0,
      "last_update": "2025-08-24T17:39:15.123456789+02:00"
    }
  }
}

Technical Details

  • Location: Likely in /internal/merger/merger.go around line 672
  • Code: stateCopy.Age = now.Sub(state.LastUpdate).Seconds()
  • Issue: Either now or state.LastUpdate calculation may be incorrect

Impact

  • Users cannot tell which aircraft have stale data
  • Frontend cannot implement proper aging/fading of old aircraft
  • Data quality indicators are not functional

Investigation Needed

  1. Verify state.LastUpdate is being set correctly when aircraft data is received
  2. Check if now timestamp is using the correct time source
  3. Ensure the age calculation is not being reset elsewhere in the code
## Problem Description The `age` field in the aircraft API response is always showing 0 seconds, which doesn't make sense as aircraft should show time since their last position update. ## Expected Behavior The `age` field should show the number of seconds since the aircraft's last update, increasing over time when aircraft haven't sent recent position reports. ## Current Behavior All aircraft consistently show `"age": 0` regardless of when they last transmitted. ## API Example ```json { "aircraft": { "4ACB58": { "ICAO24": "4ACB58", "Callsign": "SAS827 ", "age": 0, "last_update": "2025-08-24T17:39:15.123456789+02:00" } } } ``` ## Technical Details - **Location**: Likely in `/internal/merger/merger.go` around line 672 - **Code**: `stateCopy.Age = now.Sub(state.LastUpdate).Seconds()` - **Issue**: Either `now` or `state.LastUpdate` calculation may be incorrect ## Impact - Users cannot tell which aircraft have stale data - Frontend cannot implement proper aging/fading of old aircraft - Data quality indicators are not functional ## Investigation Needed 1. Verify `state.LastUpdate` is being set correctly when aircraft data is received 2. Check if `now` timestamp is using the correct time source 3. Ensure the age calculation is not being reset elsewhere in the code
olemd closed this issue 2025-09-01 10:34:12 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: olemd/skyview#3
No description provided.