-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat: persist limits to Swarm.ResourceMgr.Limits #8901
Conversation
bdb8534
to
42b6071
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @guseggert ! Did a quick pass:
Good:
- removing
limit.json
– 👍 swarm limit
always persisting toSwarm.ResourceMgr.Limits
– 👍
Needs fixing:
- helptext in
swarm limit --help
needs updating to reflect that we now always persist - Enabling resource manager via one-liner
ipfs config --json Swarm.ResourceMgr.Enabled true
needs to work (right now it is not enough, panics due to missingLimits
– see comment forcore/node/libp2p/rcmgr.go
) - + smaller comments inline
This changes the "ipfs swarm limit" command so that When limit changes are applied via the command line, they are persisted to the repo config, so that they remain in effect when the daemon restarts. This also removes limit.json support, to simplify the behavior. The schema for Swarm.ResourceMgr.Limits is exactly the same as limit.json, so existing limit.json can be dropped into the IPFS config easily using something like: cat ~/.ipfs/config | jq ".Swarm.ResourceMgr.Limits = $(cat limit.json)" | sponge ~/.ipfs/config This upgrades to Resource Manager v0.3.0, which exports the config schema so that we don't have to maintain our own copy of it.
42b6071
to
3316b0d
Compare
Makes sure we evaluate the config JSON directly, so we catch any regressions around serialization too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and works great, thank you, @guseggert 🙌
I noticed that we have no easy way to restore the implicit default once we set a custom one, but willed a separate issue for solving that: #8918 (this is nice-to-have, so could be tackled in future RCs, or pushed till 0.14)
I'm merging this one 🚀
This changes the "ipfs swarm limit" command so that When limit changes
are applied via the command line, they are persisted to the repo
config, so that they remain in effect when the daemon restarts.
This also removes limit.json support, to simplify the behavior. The
schema for Swarm.ResourceMgr.Limits is exactly the same as limit.json,
so existing limit.json can be dropped into the IPFS config easily
using something like:
$ cat ~/.ipfs/config | jq ".Swarm.ResourceMgr.Limits = $(cat limit.json)" | sponge ~/.ipfs/config
This upgrades to Resource Manager v0.3.0, which exports the config
schema so that we don't have to maintain our own copy of it.