mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-17 07:04:36 -05:00
[GH-ISSUE #2846] feat: Persist cached Newt version until next successful fetch (stale-while-revalidate) #32322
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @strausmann on GitHub (Apr 13, 2026).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/2846
Problem
The `newtUpdateAvailable` field in the Sites API response intermittently shows `false` for sites running outdated Newt versions. This happens because the cached latest Newt version expires after 1 hour (TTL), and if the subsequent GitHub API fetch fails (timeout, network issue), the cache returns `null` — causing all sites to default to `newtUpdateAvailable: false`.
Current Behavior
In `server/routers/site/listSites.ts`:
Real-World Impact
In our self-hosted setup (Hetzner Cloud), the GitHub API fetch intermittently times out (1.5s is tight for DNS resolution + TLS handshake + response). This leads to:
Observed Example
All three are outdated, but only Ollama shows the correct indicator (likely queried when GitHub was reachable within the timeout).
Proposed Solution
Stale-while-revalidate pattern: Keep the cached version until a new fetch succeeds, rather than discarding it after TTL.
Suggested Implementation
```typescript
async function getLatestNewtVersion(): Promise<string | null> {
try {
const cachedVersion = await cache.get("latestNewtVersion");
}
```
Key Changes
Environment
@strausmann commented on GitHub (Apr 13, 2026):
Closing this issue — feature requests should be submitted as GitHub Discussions per project guidelines. Re-creating as a discussion in the feature-requests category.