-
Notifications
You must be signed in to change notification settings - Fork 62
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
Exp timeout #764
Exp timeout #764
Conversation
|
common/countdown/countdown.go
Outdated
case <-t.resetc: | ||
log.Debug("Reset countdown timer") | ||
timer.Reset(t.timeoutDuration) | ||
timer.Reset(t.durationHelper.GetTimeoutDuration(inputs...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timer should be stopped before Reset
:
if !timer.Stop() {
<-timer.C
}
timer.Reset(d)
quitc chan chan struct{} | ||
initilised bool | ||
timeoutDuration time.Duration | ||
lock sync.RWMutex // Protects the Initilised field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use atomic.Bool
instead of sync.RWMutex
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe in future
common/countdown/exp_duration.go
Outdated
func (d *ExpTimeoutDuration) sanityCheck() { | ||
if d.max_exponent >= max_exponent_upperbound { | ||
log.Error("max_exponent (e)= >= max_exponent_upperbound (e_upper)", "e", d.max_exponent, "e_upper", max_exponent_upperbound) | ||
panic("max_exponent (e)= >= max_exponent_upperbound (e_upper)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Crit
can be used here instead of log.Error
and panic
. But I don't think it's a good idea to call log function in the common package.
I notice that |
yes. pushed the changes, please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to add config for all envs
maybe we will do it in another PR |
interface. add more inputs as function argument
* feat: write duration calculation in countdown as interface. add more inputs as function argument * feat: ExpTimeoutDuration * fix: three dots usage * feat: refine exp duration * feat: add exp timeout config and use it in countdown * feat: remove const countdown * feat: remove use of interface in countdown, use error * fix: countdown reset timer problem * fix: add default ExpTimeoutConfig for config
* feat: write duration calculation in countdown as interface. add more inputs as function argument * feat: ExpTimeoutDuration * fix: three dots usage * feat: refine exp duration * feat: add exp timeout config and use it in countdown * feat: remove const countdown * feat: remove use of interface in countdown, use error * fix: countdown reset timer problem * fix: add default ExpTimeoutConfig for config
Proposed changes
Exp timeout inside consensus timeout countdown
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅
in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅
in the boxes that applyChecklist
Put an
✅
in the boxes once you have confirmed below actions (or provide reasons on not doing so) that