Back to all reviewers

ensure async synchronization

cypress-io/cypress
Based on 2 comments
Other

When dealing with async operations that depend on external systems (servers, backends, etc.), ensure proper synchronization to avoid race conditions. Don't rely on client-side polling or workarounds when the root cause is improper async handling.

Concurrency Other

Reviewer Prompt

When dealing with async operations that depend on external systems (servers, backends, etc.), ensure proper synchronization to avoid race conditions. Don’t rely on client-side polling or workarounds when the root cause is improper async handling.

Key principles:

  • Make functions async when they need to wait for external operations to complete
  • Use proper sequencing for initialization dependencies
  • Ensure server acknowledgment before proceeding with dependent operations

Example of proper async sequencing:

// Instead of client-side polling workarounds
async function start(openElectron) {
  await initializeThings()
  openElectron()
}

// Make functions async when they need to ensure completion
async function reset() {
  await Cypress.backend("set:traffic:routing:reset")
}

This prevents race conditions where the UI renders before the backend is ready, or where operations proceed without confirming the previous step completed successfully.

2
Comments Analyzed
Other
Primary Language
Concurrency
Category

Source Discussions