Clean project layout and fix release workflow
Some checks failed
build-windows-exe / build (push) Failing after 1m13s
Some checks failed
build-windows-exe / build (push) Failing after 1m13s
This commit is contained in:
28
internal/app/refresh_interval.go
Normal file
28
internal/app/refresh_interval.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"vrc_osc_go/internal/config"
|
||||
)
|
||||
|
||||
const defaultGUIRefreshInterval = 2 * time.Second
|
||||
|
||||
func guiRefreshIntervalFromConfig(cfg *config.Config) time.Duration {
|
||||
if cfg == nil {
|
||||
return defaultGUIRefreshInterval
|
||||
}
|
||||
interval := cfg.GUI.RefreshInterval()
|
||||
if interval < time.Second {
|
||||
return time.Second
|
||||
}
|
||||
return interval
|
||||
}
|
||||
|
||||
func currentGUIRefreshInterval() time.Duration {
|
||||
cfg, err := config.Load("")
|
||||
if err != nil || cfg == nil {
|
||||
return defaultGUIRefreshInterval
|
||||
}
|
||||
return guiRefreshIntervalFromConfig(cfg)
|
||||
}
|
||||
Reference in New Issue
Block a user