Skip to content

Commit

Permalink
Improve rate-setter UX (#2315)
Browse files Browse the repository at this point in the history
* Improve rate-setter UX

* Adjust more parameters.
  • Loading branch information
piotrm50 authored Jul 7, 2022
1 parent abde9b0 commit 592e33c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/tangle/ratesetter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
// Wmax is the maximum inbox threshold for the node. This value denotes when maximum active mana holder backs off its rate.
Wmax = 10
// Wmin is the min inbox threshold for the node. This value denotes when nodes with the least mana back off their rate.
Wmin = 2
Wmin = 5
)

var (
Expand Down Expand Up @@ -176,7 +176,7 @@ func (r *RateSetter) rateSetting() {
ownRate /= RateSettingDecrease
r.pauseUpdates = r.initialPauseUpdates
} else {
ownRate += RateSettingIncrease * ownMana / totalMana
ownRate += math.Max(RateSettingIncrease*ownMana/totalMana, 0.01)
}
r.ownRate.Store(math.Min(r.maxRate, ownRate))
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func (r *RateSetter) initializeInitialRate() {
} else {
ownMana := math.Max(r.tangle.Options.SchedulerParams.AccessManaMapRetrieverFunc()[r.tangle.Options.Identity.ID()], MinMana)
totalMana := r.tangle.Options.SchedulerParams.TotalAccessManaRetrieveFunc()
r.ownRate.Store(math.Max(ownMana/totalMana*r.maxRate, 0.001))
r.ownRate.Store(math.Max(ownMana/totalMana*r.maxRate, 1))
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/messagelayer/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type RateSetterParametersDefinition struct {
// Initial defines the initial rate of rate setting.
Initial float64 `default:"0" usage:"the initial rate of rate setting. Set 0 to automatically estimate the value based on access mana."`
// RateSettingPause defines for how long to pause updates after decrease of rate.
RateSettingPause time.Duration `default:"2s" usage:"for how long to pause updates after decrease of rate"`
RateSettingPause time.Duration `default:"1s" usage:"for how long to pause updates after decrease of rate"`
// Enable is the flag that enables the rate setting mechanism on node startup.
Enable bool `default:"true" usage:"whether to enable rate setter"`
}
Expand Down

0 comments on commit 592e33c

Please sign in to comment.