Open Bug 1989054 Opened 4 months ago Updated 24 days ago

[meta] Apply Best Practices for Coroutines aka Coroutines Audit

Categories

(Firefox for Android :: Accounts and Sync, task)

All
Android
task

Tracking

()

ASSIGNED

People

(Reporter: mcarare, Assigned: mcarare)

References

(Depends on 12 open bugs)

Details

(Keywords: meta, Whiteboard: [fxdroid][group6] )

This meta-ticket tracks the effort to review and refactor our existing Kotlin coroutine usage to align with current best practices.

The goal is to enhance application stability, improve resource management (preventing leaks and/or unnecessary work), ensure correct thread management for UI responsiveness and I/O operations, and increase the overall clarity and testability of our asynchronous code. This involves auditing coroutine scopes, cancellation handling, dispatcher usage, exception handling, and Flow implementations.

What we should look for in the existing codebase (not an exhaustive list):

  1. GlobalScope Usage ( we already did that once, we should see if we need to do it again and add safeguards against using it improperly)
  2. Coroutine Scope Management & Lifecycle
  3. Manual creation of curoutines inside function scopes.
  4. Cancellation Handling
  5. Dispatcher Usage
  6. Exception Handling ( we might swallow CancellationExceptions)
  7. Blocking Calls in Coroutines
  8. Flow Collection & Lifecycle Awareness
  9. Suspending Function Design
Summary: [meta] Apply Best Practices for Coroutines → [meta] Apply Best Practices for Coroutines aka Coroutines Audit
Depends on: 1989061
Depends on: 1990563
Depends on: 1990613
Depends on: 1993010
Depends on: 1993744
Depends on: 2000825
Depends on: 2000831
Depends on: 2000836
Depends on: 2000841
Depends on: 2002488
Depends on: 2002506
Depends on: 2002760
Depends on: 2002763
Depends on: 2002977
No longer depends on: 2002977
Depends on: 2004035
Depends on: 2004338
Depends on: 2010612
You need to log in before you can comment on or make changes to this bug.