Skip to content

Conversation

@aseemxs
Copy link
Contributor

@aseemxs aseemxs commented Dec 1, 2025

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Address PR #6098 review feedback to eliminate file duplication and fix coroutine scope management in Gateway connection providers.

Problem:

  • Gateway files were duplicated across src-242-252/ and src-253+/ directories
  • Manually created CoroutineScope + SupervisorJob instead of using service-injected scopes

Solution:

  • Use withContext(getCoroutineBgContext()) which works across all IDE versions
  • Move files to common src/ directory, eliminating version-specific duplicates
  • Remove manual SupervisorJob creation - scopes now properly inherit from parent contexts

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes (refactoring existing code, behavior unchanged)
  • A short description of the change has been added to the
    CHANGELOG if the change is customer-facing in the IDE.
    (internal refactor, not customer-facing)
  • I have added metrics for my changes (if required) (no new metrics needed)

Testing:

  • ✅ Compiles for IDE 2024.2-2025.2
  • ✅ Compiles for IDE 2025.3+
  • ✅ Detekt code style checks pass

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aseemxs aseemxs marked this pull request as ready for review December 1, 2025 17:55
@aseemxs aseemxs requested a review from a team as a code owner December 1, 2025 17:55
…ing files

Address PR aws#6098 review feedback to avoid copying entire Gateway files
for IDE version compatibility.

Changes:
- Replace deprecated coroutine APIs with withContext(getCoroutineBgContext())
  - startChildSyncIOBackgroundAsync().await() → withContext
  - lifetime.launchIOBackground → withContext
  - lifetime.launchOnUiAnyModality → lifetime.launchOnUi
  - launchChildSyncIOBackground → withContext
- Remove manual CoroutineScope + SupervisorJob creation
- Move files to common src/ directory (works across all IDE versions)
- Delete duplicated src-242-252/ and src-253+/ versions

The withContext API is available in all IDE versions, eliminating the need
for version-specific file duplication. Coroutine scopes now properly inherit
from parent contexts instead of manually creating SupervisorJobs.

Tested:
- ✅ Compiles for IDE 2024.2-2025.2
- ✅ Compiles for IDE 2025.3+
- ✅ Detekt code style checks pass
Address PR review feedback to match original invocation semantics.

Changed from withContext (which suspends and waits) to launch
(fire-and-forget) for:
- Publishing environment started notification
- Stopping environment and reconnecting
@aseemxs aseemxs force-pushed the fix/gateway-coroutines branch from 9f0372e to 0e4b2c9 Compare December 1, 2025 19:29
@aseemxs aseemxs changed the title fix(gateway): Fix/gateway coroutines fix(toolkit): Fix/gateway coroutines Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants