Skip to content
Snippets Groups Projects
Commit 8e6d44bc authored by Josh Brooks's avatar Josh Brooks
Browse files

Track rate limiting param changes in network follower

parent 9c83d196
No related branches found
No related tags found
2 merge requests!117Release,!83Add EKV backed leaky bucket storage
...@@ -194,6 +194,28 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, ...@@ -194,6 +194,28 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
m.Session.SetNDF(m.GetInstance().GetPartialNdf().Get()) m.Session.SetNDF(m.GetInstance().GetPartialNdf().Get())
} }
// Pull rate limiting parameter values from NDF
ndfRateLimitParam := m.Instance.GetPartialNdf().Get().RateLimits
ndfCapacity, ndfLeakedTokens, ndfLeakDuration := uint32(ndfRateLimitParam.Capacity),
uint32(ndfRateLimitParam.LeakedTokens), time.Duration(ndfRateLimitParam.LeakDuration)
// Pull internal rate limiting parameters from RAM
internalRateLimitParams := m.Internal.Session.GetBucketParams().Get()
// If any param value in our internal store does not
// match the NDF's corresponding value, update our internal store
if ndfCapacity != internalRateLimitParams.Capacity ||
ndfLeakedTokens != internalRateLimitParams.LeakedTokens ||
ndfLeakDuration != internalRateLimitParams.LeakDuration {
// Update internally stored params
err = m.Internal.Session.GetBucketParams().
UpdateParams(ndfCapacity, ndfLeakedTokens, ndfLeakDuration)
if err != nil {
jww.ERROR.Printf("%+v", err)
return
}
}
// Update the address space size // Update the address space size
// todo: this is a fix for incompatibility with the live network // todo: this is a fix for incompatibility with the live network
// remove once the live network has been pushed to // remove once the live network has been pushed to
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment