Skip to content

[LOW] No request timeout on network operations #112

@Tsukieomie

Description

@Tsukieomie

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 exchange
  • src/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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions