Missing LastMirrorTimestamp in /stats endpoint after HDD failure #7

Closed
opened 2025-05-10 00:50:33 +02:00 by vikingowl · 1 comment
Collaborator

Description:

Ever since the hard drive decided to check out early, our /stats endpoint has forgotten its own memory—namely, the last_mirror_timestamp. This field is critical for rendering the “last mirror sync” time in the build status UI, but it’s nowhere to be found in the JSON response.

Steps to Reproduce:

  1. Trigger an update (or simply hit) the /stats endpoint:
curl -X GET https://api.somegit.dev/ALHP/alhp-web/stats
  1. Observe the JSON response.
  2. Notice there is no last_mirror_timestamp property under the stats object.

Actual Behavior:

{
  "stats": {
    "failed": 25,
    "skipped": 12820,
    // No last_mirror_timestamp here 😢
    ...
  }
}

Expected Behavior:

Response should include a timestamp indicating when the last mirror synchronization occurred, for example:

{
  "stats": {
    "failed": 25,
    "skipped": 12820,
    "last_mirror_timestamp": 1746830746,
    ...
  }
}

Impact:

  • Build dashboard shows “Last Mirror sync 0 seconds ago” (confusing and unhelpful).
  • Makes it harder to debug sync delays or failures.

Relevant Code:

alhp-web/api.go Lines 101 to 114 in e384635da5
if os.Getenv("ALHP_TIMESTAMP_PATH") != "" {
tsFile, err := os.ReadFile(os.Getenv("ALHP_TIMESTAMP_PATH"))
if err != nil {
log.Warningf("error reading timestamp file: %v", err)
} else {
ts, err := strconv.ParseInt(string(tsFile), 10, 64)
if err != nil {
log.Warningf("error parsing timestamp file: %v", err)
} else {
resp.LastMirrorTimestamp = &ts
}
}
}

Thanks for restoring our API’s memory! 🧠💾

## Description: Ever since the hard drive decided to check out early, our /stats endpoint has forgotten its own memory—namely, the last_mirror_timestamp. This field is critical for rendering the “last mirror sync” time in the build status UI, but it’s nowhere to be found in the JSON response. ## Steps to Reproduce: 1. Trigger an update (or simply hit) the `/stats` endpoint: ```bash curl -X GET https://api.somegit.dev/ALHP/alhp-web/stats ``` 2. Observe the JSON response. 3. Notice there is no `last_mirror_timestamp` property under the stats object. ## Actual Behavior: ```json { "stats": { "failed": 25, "skipped": 12820, // No last_mirror_timestamp here 😢 ... } } ``` ## Expected Behavior: Response should include a timestamp indicating when the last mirror synchronization occurred, for example: ```json { "stats": { "failed": 25, "skipped": 12820, "last_mirror_timestamp": 1746830746, ... } } ``` ## Impact: - Build dashboard shows “Last Mirror sync 0 seconds ago” (confusing and unhelpful). - Makes it harder to debug sync delays or failures. ## Relevant Code: https://somegit.dev/ALHP/alhp-web/src/commit/e384635da5e52d1090647e0968d1cfa5af6eb792/api.go#L101-L114 ## Thanks for restoring our API’s memory! 🧠💾
vikingowl added the bug label 2025-05-10 00:50:33 +02:00
anonfunc was assigned by vikingowl 2025-05-10 00:50:33 +02:00
Owner

Fixed.

Fixed.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ALHP/alhp-web#7