️ Do not save config changes to disk immediately

This commit is contained in:
2024-12-16 21:29:51 +01:00
parent 35681102b4
commit 5122791f85
3 changed files with 64 additions and 13 deletions

15
main.go
View File

@ -4,6 +4,7 @@ import (
"os"
"os/signal"
"syscall"
"time"
)
func main() {
@ -25,6 +26,20 @@ func main() {
// Start audio routing
startRouting()
// Periodically save config files
ticker := time.NewTicker(5 * time.Second)
go func() {
for {
select {
case <-ticker.C:
saveConfigIfMarked("ports", portConfig)
case <-end:
ticker.Stop()
return
}
}
}()
// Wait until SIGINT received
<-end