Skip to content

Commit

Permalink
fix: update based on feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Sep 26, 2024
1 parent 88807cb commit 2d05dfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions node/pkg/checker/ping/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func New(opts ...AppOption) (*App, error) {
return nil, err
}

if !withoutPrivileged || err != nil {
if !withoutPrivileged {
pinger.SetPrivileged(true)
}

Expand Down Expand Up @@ -181,7 +181,7 @@ func (app *App) Start(ctx context.Context) {
if _, exists := app.RTTAvg[result.Address]; !exists {
app.RTTAvg[result.Address] = float64(result.Delay)
} else {
app.RTTAvg[result.Address] = app.RTTAvg[result.Address]*app.Alpha + float64(result.Delay)*(1-app.Alpha)
app.RTTAvg[result.Address] = app.Alpha*float64(result.Delay) + (1-app.Alpha)*app.RTTAvg[result.Address]
}

if result.Delay > time.Duration(app.ThresholdFactor*app.RTTAvg[result.Address]) {
Expand Down

0 comments on commit 2d05dfd

Please sign in to comment.