Skip to content

Feat: add an example for spmc ring buffer#181

Open
solus161 wants to merge 3 commits into
aimdb-dev:mainfrom
solus161:feat/hello-spmc-ring-async
Open

Feat: add an example for spmc ring buffer#181
solus161 wants to merge 3 commits into
aimdb-dev:mainfrom
solus161:feat/hello-spmc-ring-async

Conversation

@solus161

Copy link
Copy Markdown

Description

This is an PR for the issue #101.

The example follows several other examples such as hello-single-latest-async. It features one producer and two consumers running at different rates and tries to simulate the lagging/dropped message behavior of the ring.

Related Issue

Checklist

  • I have read the CONTRIBUTING.md document.
  • My code follows the project's coding standards.
  • I have added tests to cover my changes.
  • All new and existing tests passed (make check).
  • I have updated the documentation accordingly.

The example follows several other examples such as
hello-single-latest-async. It features one producer and two consumers
running at different rates and tries to simulate the lagging/dropped
message behavior of the ring.
@solus161 solus161 requested a review from lxsaah as a code owner July 13, 2026 09:50

@lxsaah lxsaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR and welcome. This is really a nice first contribution! The example builds and runs cleanly, fmt/clippy are green and the slow-consumer-lags-and-drops behavior comes through clearly in the output. That's exactly the SPMC ring story we wanted for #101.

Four small changes inline below, posted as one-click suggestions. Everything else looks good to me. Thanks again for taking this one on!

Comment thread examples/hello-spmc-ring-async/Cargo.toml Outdated
Comment thread Cargo.toml Outdated
Comment thread examples/hello-spmc-ring-async/src/main.rs Outdated
Comment thread examples/hello-spmc-ring-async/src/main.rs
solus161 and others added 2 commits July 14, 2026 06:59
Remove unneeded package. Using tokio with time feature only.

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>
- Reorganize workspace order
- Switch to getting timestamp from time context instead of system unix
time
@solus161

Copy link
Copy Markdown
Author

Thanks for the PR and welcome. This is really a nice first contribution! The example builds and runs cleanly, fmt/clippy are green and the slow-consumer-lags-and-drops behavior comes through clearly in the output. That's exactly the SPMC ring story we wanted for #101.

Four small changes inline below, posted as one-click suggestions. Everything else looks good to me. Thanks again for taking this one on!

Thx for the comment. It's my first time contributing something so I'm not used to all conventions. I have repushed changes, make check and make check all are green. Plz check. Glad if I could help.

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