mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
f28b47bd87
* add changes * comment * kasey's review Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
26 lines
574 B
Go
26 lines
574 B
Go
package fdlimits
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/common/fdlimit"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// SetMaxFdLimits is a wrapper around a few go-ethereum methods to allow prysm to
|
|
// set its file descriptor limits at the maximum possible value.
|
|
func SetMaxFdLimits() error {
|
|
curr, err := fdlimit.Current()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
max, err := fdlimit.Maximum()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
raisedVal, err := fdlimit.Raise(uint64(max))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
log.Infof("Raised fd limit to %d from %d", raisedVal, curr)
|
|
return nil
|
|
}
|