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

GCC: RateController does not use the internal state #271

Open
N1cOs opened this issue Aug 9, 2024 · 0 comments
Open

GCC: RateController does not use the internal state #271

N1cOs opened this issue Aug 9, 2024 · 0 comments

Comments

@N1cOs
Copy link

N1cOs commented Aug 9, 2024

Your environment.

  • Version: v0.1.30

What did you do?

RateController on the delay stats update doesn't use the internals state. Should we make a transition from the internal state, not from the current one (which is always increase actually)? Snippet from the rate_controller.go :

func (c *rateController) onDelayStats(ds DelayStats) {
	now := time.Now()

	if !c.init {
		c.delayStats = ds
		c.delayStats.State = stateIncrease
		c.init = true
		return
	}
	c.delayStats = ds
	// Transition from the current state?
	c.delayStats.State = c.delayStats.State.transition(ds.Usage)

	if c.delayStats.State == stateHold {
		return
	}

	// ... more logic
}

What did you expect?

Using the internal state (smth like this):

func (c *rateController) onDelayStats(ds DelayStats) {
	now := time.Now()

	if !c.init {
		c.delayStats = ds
		c.delayStats.State = stateIncrease
		c.init = true
		return
	}
	
	prev := c.delayStats
	c.delayStats = ds
	c.delayStats.State = prev.State.transition(ds.Usage)

	if c.delayStats.State == stateHold {
		return
	}

	// ... more logic
}

What happened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant