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

Feat: Implement ipfs swarm limit [scope] --reset #8950

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ghvstcode
Copy link

@Ghvstcode Ghvstcode commented May 6, 2022

Hey there,
This PR adds support for resetting custom limits by scope to implicit defaults.

Closes #8918!
———
Summary

  • Add an optional reset flag to enable resetting to default
  • Persist default settings without node restart

@welcome
Copy link

welcome bot commented May 6, 2022

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@Ghvstcode
Copy link
Author

Hi @guseggert, @lidel

@BigLep BigLep linked an issue Jun 3, 2022 that may be closed by this pull request
@BigLep BigLep requested a review from schomatis June 3, 2022 15:53
@BigLep
Copy link
Contributor

BigLep commented Jun 3, 2022

@schomatis : can you take this PR please? I believe the related issue has the important context.

@BigLep
Copy link
Contributor

BigLep commented Jun 3, 2022

@schomatis : if there are followup questions, @guseggert can help.

@Jorropo
Copy link
Contributor

Jorropo commented Jun 3, 2022

It solves issue #8918!

Not related on the code at all.
Just FYI, when you do this kind of stuff pls use a syntax github understands like:

Closes #8918

or

Fixes #8918

Also pls add this as it's own paragraph.
(we usually put it at the end but I don't have any preference)

Then github will wire "may be fixed messages" and automatically close the issue if this gets merged. 🙂

@schomatis
Copy link
Contributor

Ack, will review next week.

@Ghvstcode Thanks for the patch. We're likely going to need a test for this command in sharness. If you're not familiar with it could you write here an example run of your command and what output you'd expect, please? Without any context on this I'm assuming it'd be something like:

ipfs swarm limit <set a limit that it's not the default>
ipfs swarm limit --reset
ipfs swarm limit
# Check that it matches default.

# (and probably a similar one with a scope set that resets only that one and not the rest)

(Basically your command and the expected output in a couple of typical use cases.)

@schomatis
Copy link
Contributor

For more background the other rcmgr tests are in:

https://github.com/ipfs/go-ipfs/blob/master/test/sharness/t0139-swarm-rcmgr.sh.

Comment on lines +422 to +443
case true:
result.Dynamic = true
result.MemoryFraction = mem.MemoryFraction
result.MinMemory = mem.MinMemory
result.MaxMemory = mem.MaxMemory
result.Streams = limit.Streams
result.StreamsInbound = limit.StreamsInbound
result.StreamsOutbound = limit.StreamsOutbound
result.Conns = limit.Conns
result.ConnsInbound = limit.ConnsInbound
result.ConnsOutbound = limit.ConnsOutbound
result.FD = limit.FD
case false:
result.Dynamic = false
result.Memory = mem.GetMemory(int64(memory.TotalMemory()))
result.Streams = limit.Streams
result.StreamsInbound = limit.StreamsInbound
result.StreamsOutbound = limit.StreamsOutbound
result.Conns = limit.Conns
result.ConnsInbound = limit.ConnsInbound
result.ConnsOutbound = limit.ConnsOutbound
result.FD = limit.FD
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🔎 In Review
Development

Successfully merging this pull request may close these issues.

Implement ipfs swarm limit [scope] --reset
4 participants