-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from opentofu/rlimit
Added automatic rlimit handling
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//go:build !windows | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"syscall" | ||
|
||
"github.com/opentofu/libregistry/logger" | ||
) | ||
|
||
func setRLimit(ctx context.Context, log logger.Logger) error { | ||
log.Info(ctx, "Setting maximum number of file descriptors to 50000...") | ||
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &syscall.Rlimit{ | ||
Cur: 50000, | ||
Max: 50000, | ||
}); err != nil { | ||
log.Warn(ctx, "Failed to set rlimit, generation may fail on larger repositories (%v)", err) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build windows | ||
|
||
package main | ||
|
||
func setRLimit(ctx context.Context, log logger.Logger) error { | ||
return nil | ||
} |