mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 00:54:23 +00:00
Add timeout check interval and update instance configuration
This commit is contained in:
@@ -182,6 +182,7 @@ instances:
|
|||||||
default_auto_restart: true # Default auto-restart setting
|
default_auto_restart: true # Default auto-restart setting
|
||||||
default_max_restarts: 3 # Default maximum restart attempts
|
default_max_restarts: 3 # Default maximum restart attempts
|
||||||
default_restart_delay: 5 # Default restart delay in seconds
|
default_restart_delay: 5 # Default restart delay in seconds
|
||||||
|
timeout_check_interval: 5 # Default instance timeout check interval in minutes
|
||||||
```
|
```
|
||||||
|
|
||||||
**Environment Variables:**
|
**Environment Variables:**
|
||||||
@@ -195,6 +196,7 @@ instances:
|
|||||||
- `LLAMACTL_DEFAULT_AUTO_RESTART` - Default auto-restart setting (true/false)
|
- `LLAMACTL_DEFAULT_AUTO_RESTART` - Default auto-restart setting (true/false)
|
||||||
- `LLAMACTL_DEFAULT_MAX_RESTARTS` - Default maximum restarts
|
- `LLAMACTL_DEFAULT_MAX_RESTARTS` - Default maximum restarts
|
||||||
- `LLAMACTL_DEFAULT_RESTART_DELAY` - Default restart delay in seconds
|
- `LLAMACTL_DEFAULT_RESTART_DELAY` - Default restart delay in seconds
|
||||||
|
- `LLAMACTL_TIMEOUT_CHECK_INTERVAL` - Default instance timeout check interval in minutes
|
||||||
|
|
||||||
#### Authentication Configuration
|
#### Authentication Configuration
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ type InstancesConfig struct {
|
|||||||
|
|
||||||
// Default restart delay for new instances (in seconds)
|
// Default restart delay for new instances (in seconds)
|
||||||
DefaultRestartDelay int `yaml:"default_restart_delay"`
|
DefaultRestartDelay int `yaml:"default_restart_delay"`
|
||||||
|
|
||||||
|
// Interval for checking instance timeouts (in minutes)
|
||||||
|
TimeoutCheckInterval int `yaml:"timeout_check_interval"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthConfig contains authentication settings
|
// AuthConfig contains authentication settings
|
||||||
@@ -108,6 +111,7 @@ func LoadConfig(configPath string) (AppConfig, error) {
|
|||||||
DefaultAutoRestart: true,
|
DefaultAutoRestart: true,
|
||||||
DefaultMaxRestarts: 3,
|
DefaultMaxRestarts: 3,
|
||||||
DefaultRestartDelay: 5,
|
DefaultRestartDelay: 5,
|
||||||
|
TimeoutCheckInterval: 5, // Check timeouts every 5 minutes
|
||||||
},
|
},
|
||||||
Auth: AuthConfig{
|
Auth: AuthConfig{
|
||||||
RequireInferenceAuth: true,
|
RequireInferenceAuth: true,
|
||||||
@@ -217,6 +221,11 @@ func loadEnvVars(cfg *AppConfig) {
|
|||||||
cfg.Instances.DefaultRestartDelay = seconds
|
cfg.Instances.DefaultRestartDelay = seconds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if timeoutCheckInterval := os.Getenv("LLAMACTL_TIMEOUT_CHECK_INTERVAL"); timeoutCheckInterval != "" {
|
||||||
|
if minutes, err := strconv.Atoi(timeoutCheckInterval); err == nil {
|
||||||
|
cfg.Instances.TimeoutCheckInterval = minutes
|
||||||
|
}
|
||||||
|
}
|
||||||
// Auth config
|
// Auth config
|
||||||
if requireInferenceAuth := os.Getenv("LLAMACTL_REQUIRE_INFERENCE_AUTH"); requireInferenceAuth != "" {
|
if requireInferenceAuth := os.Getenv("LLAMACTL_REQUIRE_INFERENCE_AUTH"); requireInferenceAuth != "" {
|
||||||
if b, err := strconv.ParseBool(requireInferenceAuth); err == nil {
|
if b, err := strconv.ParseBool(requireInferenceAuth); err == nil {
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ func validateAndCopyOptions(name string, options *CreateInstanceOptions) *Create
|
|||||||
if options.IdleTimeout != nil {
|
if options.IdleTimeout != nil {
|
||||||
idleTimeout := *options.IdleTimeout
|
idleTimeout := *options.IdleTimeout
|
||||||
if idleTimeout < 0 {
|
if idleTimeout < 0 {
|
||||||
log.Printf("Instance %s IdleTimeout value (%d) cannot be negative, setting to 0 seconds", name, idleTimeout)
|
log.Printf("Instance %s IdleTimeout value (%d) cannot be negative, setting to 0 minutes", name, idleTimeout)
|
||||||
idleTimeout = 0
|
idleTimeout = 0
|
||||||
}
|
}
|
||||||
optionsCopy.IdleTimeout = &idleTimeout
|
optionsCopy.IdleTimeout = &idleTimeout
|
||||||
@@ -156,7 +156,7 @@ func applyDefaultOptions(options *CreateInstanceOptions, globalSettings *config.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if options.IdleTimeout == nil {
|
if options.IdleTimeout == nil {
|
||||||
defaultIdleTimeout := 0 // Default to 0 seconds if not set
|
defaultIdleTimeout := 0
|
||||||
options.IdleTimeout = &defaultIdleTimeout
|
options.IdleTimeout = &defaultIdleTimeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
pkg/instance/timeout.go
Normal file
1
pkg/instance/timeout.go
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package instance
|
||||||
Reference in New Issue
Block a user