Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(base_node_config): check_interval is 0 made base node is panicked #4495

Conversation

hnidoaht-101
Copy link
Contributor

Description

This PR served for fixing the bug described in #4399

Motivation and Context

My target is finding a way to change it with as little change and minimal impact as possible. So here's how I can think of it. I'm not sure if this is the best solution. Any comments are welcome.

How Has This Been Tested?

Build runs in local fork, with check_interval = 0 and w/o check_interval setting.

@hnidoaht-101 hnidoaht-101 changed the title fix(base_node_config): check_interva l is 0 made base node is panicked fix(base_node_config): check_interval is 0 made base node is panicked Aug 18, 2022
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

This doesn't address the root bug in the auto-update component. Apologies, I didn't look properly and thought the change was in the config higher up. This change does indeed address the issue and this comment changes to a nit :)

nit: code-readability, needless-complexity
I suggest reverting and handle the edge case in base_layer/p2p/src/auto_update/service.rs line: 97

 let mut interval_or_never = match self.config.check_interval {
     // Add this line
        Some(interval) if interval.is_zero() => Either::Right(stream::empty()),
            Some(interval) => {
                let mut interval = time::interval(interval);
                interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
                Either::Left(wrappers::IntervalStream::new(interval))
            },
            None => Either::Right(stream::empty()),
        };

@hnidoaht-101 hnidoaht-101 force-pushed the chore/fix-config-check-interval-panicked branch from afdf169 to a44933a Compare August 18, 2022 05:32
@hnidoaht-101
Copy link
Contributor Author

Thanks for the PR!

This doesn't address the root bug in the auto-update component. Apologies, I didn't look properly and thought the change was in the config higher up. This change does indeed address the issue and this comment changes to a nit :)

nit: code-readability, needless-complexity I suggest reverting and handle the edge case in base_layer/p2p/src/auto_update/service.rs line: 97

 let mut interval_or_never = match self.config.check_interval {
     // Add this line
        Some(interval) if interval.is_zero() => Either::Right(stream::empty()),
            Some(interval) => {
                let mut interval = time::interval(interval);
                interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
                Either::Left(wrappers::IntervalStream::new(interval))
            },
            None => Either::Right(stream::empty()),
        };

Thank you. How beautiful it is! I've pushed updates as your suggestion.

@hnidoaht-101 hnidoaht-101 requested a review from sdbondi August 18, 2022 05:33
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

Thanks 🎉 - utAck

@aviator-app aviator-app bot merged commit ba4fbf7 into tari-project:development Aug 18, 2022
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