Skip to content

- #2661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed

Conversation

suojae
Copy link

@suojae suojae commented Apr 15, 2025

Fixes #2553

Problem Description

The current implementation of AsyncSequence.asObservable() can potentially execute on the main thread, which may cause UI blocking issues. This becomes especially problematic when the AsyncSequence performs time-consuming operations.

Changes

Modified AsyncSequence.asObservable() to use Task.detached, ensuring the sequence always runs on a background thread. This change guarantees that AsyncSequence operations won't block the main thread.

Testing

  • Successfully passed all existing tests (1793 tests, 0 failures)
  • Added and passed test cases that verify execution on background threads
  • Included additional test cases covering edge scenarios (with sleep operations, error handling)

@suojae suojae force-pushed the fix/async-sequence-background-thread branch 2 times, most recently from 934600d to 3ff3f15 Compare April 15, 2025 13:30
@suojae suojae force-pushed the fix/async-sequence-background-thread branch from 3ff3f15 to b0e5e21 Compare April 16, 2025 00:01
@suojae suojae closed this Apr 16, 2025
@suojae suojae changed the title Ensure AsyncSequence.asObservable() runs on background thread - Apr 16, 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.

AsyncSequence.asObservable() effect is not as expected
1 participant