Skip to content

Commit

Permalink
fix windows rlimit
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Gilat committed Sep 27, 2017
1 parent 2ba68cd commit 0bba374
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
10 changes: 0 additions & 10 deletions cmd/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"sync"
"syscall"
)

// IOGroup wraps a WaitGroup with an additional rate-limit interface.
Expand Down Expand Up @@ -38,15 +37,6 @@ func NewIOGroup() IOGroup {
return &ioGroup{limit: limit, wg: wg, limiter: limiter}
}

func checkLimit() int {
var rlimit syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
if err != nil {
return 50 // true random
}
return int(rlimit.Cur)
}

type ioGroup struct {
limit int
wg *sync.WaitGroup
Expand Down
14 changes: 14 additions & 0 deletions cmd/limit_others.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build !windows

package cmd

import "syscall"

func checkLimit() int {
var rlimit syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
if err != nil {
return 50 // true random
}
return int(rlimit.Cur)
}
5 changes: 5 additions & 0 deletions cmd/limit_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package cmd

func checkLimit() int {
return 50 // oy windows
}

0 comments on commit 0bba374

Please sign in to comment.