mirror of
https://github.com/mudler/LocalAI.git
synced 2026-02-18 08:09:22 -06:00
chore: move defaults to constants
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
@@ -4,7 +4,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const DefaultWatchdogInterval = 500 * time.Millisecond
|
||||
const (
|
||||
DefaultWatchdogInterval = 500 * time.Millisecond
|
||||
DefaultMemoryReclaimerThreshold = 0.80
|
||||
)
|
||||
|
||||
// WatchDogOptions contains all configuration for the WatchDog
|
||||
type WatchDogOptions struct {
|
||||
@@ -112,7 +115,7 @@ func DefaultWatchDogOptions() *WatchDogOptions {
|
||||
idleCheck: false,
|
||||
lruLimit: 0,
|
||||
memoryReclaimerEnabled: false,
|
||||
memoryReclaimerThreshold: 0.80,
|
||||
memoryReclaimerThreshold: DefaultMemoryReclaimerThreshold,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ var _ = Describe("WatchDog", func() {
|
||||
model.WithProcessManager(pm),
|
||||
)
|
||||
_, threshold := wd.GetMemoryReclaimerSettings()
|
||||
Expect(threshold).To(Equal(0.95)) // default
|
||||
Expect(threshold).To(Equal(model.DefaultMemoryReclaimerThreshold))
|
||||
})
|
||||
|
||||
It("should allow updating memory reclaimer settings dynamically", func() {
|
||||
@@ -318,7 +318,7 @@ var _ = Describe("WatchDog", func() {
|
||||
|
||||
enabled, threshold := wd.GetMemoryReclaimerSettings()
|
||||
Expect(enabled).To(BeFalse())
|
||||
Expect(threshold).To(Equal(0.95))
|
||||
Expect(threshold).To(Equal(model.DefaultMemoryReclaimerThreshold))
|
||||
})
|
||||
|
||||
It("should allow combining multiple options", func() {
|
||||
|
||||
Reference in New Issue
Block a user