mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
cmd/utils: max out the OS file allowance, don't cap to 2K (#18211)
This commit is contained in:
parent
4976b7cbb3
commit
cb8a9edd03
1 changed files with 3 additions and 8 deletions
|
|
@ -818,17 +818,12 @@ func setPrefix(ctx *cli.Context, cfg *node.Config) {
|
|||
// MakeDatabaseHandles raises out the number of allowed file handles per process
|
||||
// for XDC and returns half of the allowance to assign to the database.
|
||||
func MakeDatabaseHandles() int {
|
||||
limit, err := fdlimit.Current()
|
||||
limit, err := fdlimit.Maximum()
|
||||
if err != nil {
|
||||
Fatalf("Failed to retrieve file descriptor allowance: %v", err)
|
||||
}
|
||||
if limit < 2048 {
|
||||
if err := fdlimit.Raise(2048); err != nil {
|
||||
Fatalf("Failed to raise file descriptor allowance: %v", err)
|
||||
}
|
||||
}
|
||||
if limit > 2048 { // cap database file descriptors even if more is available
|
||||
limit = 2048
|
||||
if err := fdlimit.Raise(uint64(limit)); err != nil {
|
||||
Fatalf("Failed to raise file descriptor allowance: %v", err)
|
||||
}
|
||||
return limit / 2 // Leave half for networking and other stuff
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue