Skip to content

Conversation

@godexsoft
Copy link
Collaborator

This PR implements go-like channels wrapper (on top of asio experimental channels).
In the future this will be integrated into the AsyncFramework.

@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 94.54545% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.91%. Comparing base (5269ea0) to head (83c692e).

Files with missing lines Patch % Lines
src/util/Channel.hpp 94.54% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2859      +/-   ##
===========================================
+ Coverage    81.86%   81.91%   +0.04%     
===========================================
  Files          381      382       +1     
  Lines        14417    14472      +55     
  Branches      7935     7951      +16     
===========================================
+ Hits         11803    11855      +52     
  Misses        1446     1446              
- Partials      1168     1171       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@mathbunnyru mathbunnyru left a comment

Choose a reason for hiding this comment

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

I haven't read test file yet, will review a bit later

result = std::forward<decltype(value)>(value);
});

if (received)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible for some reason to have error in ec, but received True?
And why is there 2 ways to communicate the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not too sure we actually need the ec at all as we don't actually use it when we send. when we receive i imagine there should be an internal ec somewhere. I will check if we can get rid of it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm, i could not remove error_code from the channel signature. I expected that would be easy but looks like you need that error_code in the signature

mathbunnyru
mathbunnyru previously approved these changes Dec 15, 2025

if (params_.approachType == ApproachType::Spawn) {
util::spawn(executor, [&receiver, &receivedValues](boost::asio::yield_context yield) mutable {
while (receivedValues.size() < kTOTAL_EXPECTED) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should check that we have exactly kTOTAL_EXPECTED values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We check it below already, is that not what you meant?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, my wording is bad.

Right now you're pushing to vector only if while (receivedValues.size() < kTOTAL_EXPECTED), so it's impossible you're going to have more than kTOTAL_EXPECTED values pushed to vector

This doesn't check that receiver is not able to receive a few more values though.
Imagine, there is a bug, and we do not account for some values in queue when receiving.

I suggest after this while to write tryReceive and check it fails

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