| 578 | } |
| 579 | |
| 580 | private shouldFetchWorkspace(entry: WorkspacePRCacheEntry | undefined, now: number): boolean { |
| 581 | if (!entry) return true; |
| 582 | // Allow refresh if entry was hydrated from localStorage (fetchedAt === 0) |
| 583 | // but is marked loading - this means we have stale cached data and need fresh data. |
| 584 | if (entry.loading && entry.fetchedAt !== 0) return false; |
| 585 | |
| 586 | if (entry.error) { |
| 587 | return now - entry.fetchedAt > ERROR_RETRY_DELAY_MS; |
| 588 | } |
| 589 | |
| 590 | return now - entry.fetchedAt > STATUS_CACHE_TTL_MS; |
| 591 | } |
| 592 | |
| 593 | /** |
| 594 | * Refresh PR status for all subscribed workspaces. |