Skip to content

Commit 836302d

Browse files
gzliudanwanwiset25
authored andcommitted
cmd/utils: max out the OS file allowance, don't cap to 2K (ethereum#18211)
1 parent 540ff05 commit 836302d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

cmd/utils/flags.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -817,17 +817,12 @@ func setPrefix(ctx *cli.Context, cfg *node.Config) {
817817
// MakeDatabaseHandles raises out the number of allowed file handles per process
818818
// for XDC and returns half of the allowance to assign to the database.
819819
func MakeDatabaseHandles() int {
820-
limit, err := fdlimit.Current()
820+
limit, err := fdlimit.Maximum()
821821
if err != nil {
822822
Fatalf("Failed to retrieve file descriptor allowance: %v", err)
823823
}
824-
if limit < 2048 {
825-
if err := fdlimit.Raise(2048); err != nil {
826-
Fatalf("Failed to raise file descriptor allowance: %v", err)
827-
}
828-
}
829-
if limit > 2048 { // cap database file descriptors even if more is available
830-
limit = 2048
824+
if err := fdlimit.Raise(uint64(limit)); err != nil {
825+
Fatalf("Failed to raise file descriptor allowance: %v", err)
831826
}
832827
return limit / 2 // Leave half for networking and other stuff
833828
}

0 commit comments

Comments
 (0)