Open
Conversation
… internally for each message response type.
added 2 commits
February 25, 2026 19:00
zeerekahmad
reviewed
Feb 25, 2026
| auto query_frame = relay_impl_.getRelayQueryMessage(); | ||
| std::lock_guard<std::mutex> lock(query_mutex_); | ||
|
|
||
| // If a request is already in-flight, check if it has timed out |
Contributor
There was a problem hiding this comment.
Is this logic necessary? Do we actually care to reject or would we rather just resend? The other promise would just time out because we resent and the new one would be used.
But since we only have 1 request in flight at a time, that should not matter?
zeerekahmad
reviewed
Feb 25, 2026
|
|
||
| // Create a new promise and get its future | ||
| std::promise<MvecRelayQueryReply> promise; | ||
| std::promise<std::optional<MvecRelayQueryReply>> promise; |
Contributor
There was a problem hiding this comment.
Why promise optional? That seems redundant?
zeerekahmad
reviewed
Feb 25, 2026
| /// @brief Mutex protecting promise queues for thread safety | ||
| std::mutex promises_mutex_; | ||
| /// @brief Single-slot promise for population query response | ||
| std::optional<std::promise<std::optional<MvecPopulationReply>>> population_reply_promise_; |
Contributor
There was a problem hiding this comment.
I don't know if you need optional here! Just don't fulfill the promise, the future will take care of not having a value!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
The Problem:
The Solution:
Pros for this Method:
Cons for this Method:
relay_query_result.has_value()orrelay_query_result == std::nullopt(both will work)TBH, I'm not entirely sure how hard this will be to code around, so lmk if you have suggestions