⚡️ Do not save config changes to disk immediately
This commit is contained in:
15
main.go
15
main.go
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user