Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Round-based status stream break-off #1980

Merged
merged 11 commits into from
Dec 27, 2018
Merged

Round-based status stream break-off #1980

merged 11 commits into from
Dec 27, 2018

Conversation

Akvinikym
Copy link
Contributor

IR-130

Description of the Change

Previously, if status of the transaction was not updated for some time, status stream, on which client was subscribed, went off. This is a correct behaviour, but instead of waiting for time, Iroha should wait for some rounds to complete, and this is what this PR does.

Benefits

More correct behaviour.

Possible Drawbacks

None.

Signed-off-by: Akvinikym <anarant12@gmail.com>
Signed-off-by: Akvinikym <anarant12@gmail.com>
Signed-off-by: Akvinikym <anarant12@gmail.com>
Signed-off-by: Akvinikym <anarant12@gmail.com>
@neewy neewy added this to the rc2 milestone Dec 21, 2018
@nickaleks
Copy link
Contributor

Cool PR name :)

@l4l l4l added the needs-review pr awaits review from maintainers label Dec 21, 2018
std::lock_guard<std::mutex> lock{this->mutex_};
auto it = subscriptions_.begin();
while (it != subscriptions_.end()) {
if (++it->second.counter >= kMaxCounterValue) {
Copy link
Contributor

Choose a reason for hiding this comment

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

that will perform increment, even if the condition isn't true. That might have some undesirable edge-case issues, e.g if kMaxCounterValue == UINT8_MAX

Signed-off-by: Akvinikym <anarant12@gmail.com>
Copy link
Contributor

@nickaleks nickaleks left a comment

Choose a reason for hiding this comment

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

Please fix small issues


std::mutex round_update_mutex_;
std::shared_ptr<iroha::network::ConsensusGate> consensus_gate_;
const int kMaximumRoundsWithoutUpdate;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a constant since you set it in a constructor, so usual naming should be used here.

round_notifier.get_subscriber().on_next(iroha::consensus::BlockReject{});

// if this join happens, this means that stream is off
t.join();
Copy link
Contributor

Choose a reason for hiding this comment

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

This test will never terminate if the code it tests is broken. Please add a timeout, after which the test has failed.

Signed-off-by: Akvinikym <anarant12@gmail.com>
Signed-off-by: Akvinikym <anarant12@gmail.com>
Signed-off-by: Akvinikym <anarant12@gmail.com>
@l4l l4l removed the needs-review pr awaits review from maintainers label Dec 26, 2018
Signed-off-by: Akvinikym <anarant12@gmail.com>
Signed-off-by: Akvinikym <anarant12@gmail.com>
Signed-off-by: Akvinikym <anarant12@gmail.com>
@Akvinikym Akvinikym merged commit 14f8334 into dev Dec 27, 2018
@Akvinikym Akvinikym deleted the feature/rnd-based-status branch December 27, 2018 17:12
@lebdron lebdron mentioned this pull request Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants