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

fix: clarity: no user supplied rcmgr limits of 0 #9563

Conversation

BigLep
Copy link
Contributor

@BigLep BigLep commented Jan 19, 2023

The goal of this commit is to make clear that we don't support user-supplied limits of 0 currently. Apply (https://github.com/libp2p/go-libp2p/blob/master/p2p/host/resource-manager/limit.go#L102 ) overrides any 0 value. With the current code, a zero-limit in userSuppliedOverrideLimitConfig will be overridden by the computed default limits.

I want to be able to do:

defaultComputedLimitConfig.Apply(userSuppliedOverrideLimitConfig)

but that won't override any of the computed defaults.

I'd like to see this fixed, but this at least make clear the situation.

The goal of this commit is to make clear that we don't support user-supplied limits of 0 currently.
Apply (https://github.com/libp2p/go-libp2p/blob/master/p2p/host/resource-manager/limit.go#L102 ) overrides any 0 value.  
With the current code, a zero-limit in userSuppliedOverrideLimitConfig will be overridden by the computed default limits.

I want to be able to do:

```
defaultComputedLimitConfig.Apply(userSuppliedOverrideLimitConfig)
```

but that won't override any of the computed defaults.

I'd like to see this fixed, but this at least make clear the situation.
core/node/libp2p/rcmgr.go Outdated Show resolved Hide resolved
@lidel lidel changed the title Clarity: no user supplied rcmgr limits of 0 fix: clarity: no user supplied rcmgr limits of 0 Jan 19, 2023
@BigLep BigLep mentioned this pull request Jan 19, 2023
BigLep and others added 2 commits January 19, 2023 08:26
Co-authored-by: Antonio Navarro Perez <antnavper@gmail.com>
@BigLep BigLep requested a review from lidel January 19, 2023 16:33
@BigLep
Copy link
Contributor Author

BigLep commented Jan 19, 2023

I think we're good to merge now @lidel , but will let you check.

@ajnavarro
Copy link
Member

@BigLep You need to format the code to make Go checks pass.

@BigLep
Copy link
Contributor Author

BigLep commented Jan 20, 2023

Doh - thanks @ajnavarro . I guess that's what I get for making Go code changes in the Github UI. It looks like I'm good now...

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this PR for a spin and agree we are better with it in 0.18. Merging. 👍

Some thoughts:

@lidel lidel merged commit 9327ee6 into master Jan 22, 2023
@lidel lidel deleted the fix/clarity-resource-mgr-user-overrides-with-zero-values-not-supported branch January 22, 2023 19:04
galargh pushed a commit that referenced this pull request Jan 23, 2023
Co-authored-by: Antonio Navarro Perez <antnavper@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants