-
Notifications
You must be signed in to change notification settings - Fork 435
Open
Description
Reliability Issue: Missing Request Timeouts
Severity: LOW
Location: src/main/auth-manager.ts:45, 110 (auth exchange/refresh)
Description
fetch() calls without timeout can hang indefinitely, blocking auth flow.
Code
// No timeout ✗
const response = await fetch(tokenUrl, {
method: 'POST',
body: formData,
})Risk
- Hanging requests block auth flow
- Poor user experience on slow/failing networks
- App appears frozen during network issues
Recommendation
Use AbortSignal.timeout()
const controller = new AbortController()
const timeout = setTimeout(() => controller.abort(), 10000) // 10s
try {
const response = await fetch(tokenUrl, {
method: 'POST',
body: formData,
signal: controller.signal, // ✓
})
clearTimeout(timeout)
} catch (err) {
if (err.name === 'AbortError') {
throw new Error('Request timeout - please check your network')
}
throw err
}Or use modern API
// Modern browsers/Node support this
const response = await fetch(tokenUrl, {
method: 'POST',
body: formData,
signal: AbortSignal.timeout(10000), // ✓ Clean!
})Files to Update
src/main/auth-manager.ts- auth token exchangesrc/main/auth-manager.ts- token refresh- Any other
fetch()calls in codebase
Impact
Low - Improves reliability and user experience on poor networks.
Labels: enhancement, networking
Metadata
Metadata
Assignees
Labels
No labels