Skip to content

perf(bloc_concurrency): cancel droppable subscriptions concurrently - #4915

Open
palmoni5 wants to merge 1 commit into
felangel:masterfrom
palmoni5:bloc_concurrency/droppable-concurrent-cancel
Open

palmoni5 wants to merge 1 commit into
felangel:masterfrom
palmoni5:bloc_concurrency/droppable-concurrent-cancel

Conversation

@palmoni5

Copy link
Copy Markdown

Status

READY

Breaking Changes

NO

Description

When the output of droppable() is cancelled, the transformer used to await the active mapped subscription's cancellation before it started cancelling the source subscription. A slow mapped cleanup therefore delayed releasing the source. Now both cancellations start immediately and are awaited together with Future.wait, so an error from either one still propagates. This is the same pattern bloc's internal flat-map transformer uses.

Tests:

  • Source cancellation starts while the mapped cancellation is blocked. This test fails before the change.
  • Cancelling while idle releases the source.

In a local benchmark where the mapped cancellation takes about 100ms, the source is now released in under 1ms instead of after about 105ms.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Start canceling the source subscription without waiting for the active
mapped subscription's cancellation to complete, so a slow mapped cleanup
no longer delays releasing the source.

This branch has not been deployed

No deployments
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.

1 participant