Skip to content

durability: Use async-channel to allow blocking send#4802

Merged
joshua-spacetime merged 2 commits intomasterfrom
kim/durability/async-channel
Apr 14, 2026
Merged

durability: Use async-channel to allow blocking send#4802
joshua-spacetime merged 2 commits intomasterfrom
kim/durability/async-channel

Conversation

@kim
Copy link
Copy Markdown
Contributor

@kim kim commented Apr 14, 2026

The previous approaches would either:

  • panic when the queue becomes full, as append_tx is run inside the context of a LocalSet, which is basically a glorified current thread runtime
  • deadlock because the receiver runtime has no way of notifiying the sender of freed capacity in the channel

async-channel handles wait queues and notifications internally, so can be used freely from either blocking or async contexts.

This may come at different performance characteristics, but I haven't measured them.

The previous approaches would either:

- panic when the queue becomes full, as `append_tx` is run inside the
  context of a `LocalSet`, which is basically a glorified current thread
  runtime
- deadlock because the receiver runtime has no way of notifiying the
  sender of freed capacity in the channel

`async-channel` handles wait queues and notifications internally, so can
be used freely from either blocking or async contexts.

This _may_ come at different performance characteristics, but I haven't
measured them.
@kim kim requested a review from joshua-spacetime April 14, 2026 11:06
Copy link
Copy Markdown
Collaborator

@joshua-spacetime joshua-spacetime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran some benchmarks and it didn't seem to negatively affect performance in any way.

@joshua-spacetime joshua-spacetime added this pull request to the merge queue Apr 14, 2026
Merged via the queue into master with commit 2b3aa5a Apr 14, 2026
49 of 54 checks passed
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