Skip to content

Limit go routines #1

@mguentner

Description

@mguentner

https://github.com/NixIPFS/create-nixipfs-go/blob/master/create_nixipfs.go#L75

Opens too many files at once. Limit this by using a buffered chan, like so:

        maxAddRoutines := 10
        if err != nil {
                log.Fatal(err)
        }
        c0 := make(chan struct{}, maxAddRoutines)
        for _, f := range files {
                c0 <- struct{}{}
                go func(f string) {
                        AddToIPFS(sh, f)
                        <-c0
                }(f)
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions