File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const (
3131 FLY_GATEWAY_URI = "FLY_GATEWAY_URI"
3232 GATEWAY_API_KEY = "GATEWAY_API_KEY"
3333 GATEWAY_REQUEST_API_KEY = "GATEWAY_REQUEST_API_KEY"
34+ FILE_DESCRIPTOR_LIMIT = "FILE_DESCRIPTOR_LIMIT"
3435)
3536
3637// This may evolve to include config outside env, or use .env file for
@@ -59,6 +60,7 @@ func setupConfig() *Config {
5960 config .defaults [LOG_HTTP_RESPONSE ] = "false"
6061 config .defaults [LOG_BALANCE_UPDATE ] = "false"
6162 config .defaults [LOG_HTTP_REQUEST_FILTER ] = ""
63+ config .defaults [FILE_DESCRIPTOR_LIMIT ] = "5000"
6264
6365 level := parseLogLevel (os .Getenv (LOG_LEVEL ))
6466 config .SetLogLevel (level )
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ type HealthStatus struct {
1919// New function to check file descriptor health and log the results using slog
2020func checkFileDescriptorHealth () bool {
2121 var rLimit unix.Rlimit
22+ fdLimit := common .GetConfigInt ("FILE_DESCRIPTOR_LIMIT" )
2223
2324 // Get the max number of allowed file descriptors
2425 err := unix .Getrlimit (unix .RLIMIT_NOFILE , & rLimit )
@@ -35,7 +36,7 @@ func checkFileDescriptorHealth() bool {
3536 }
3637 fdUsage := uint64 (len (files ))
3738
38- healthy := fdUsage < rLimit . Cur * 80 / 100
39+ healthy := fdUsage < uint64 ( fdLimit )
3940
4041 // Log the file descriptor information using slog
4142 slog .Info ("File Descriptor Usage" ,
You can’t perform that action at this time.
0 commit comments