fix: prevent concurrent transcription races and mask API key

This commit is contained in:
Your Name
2026-06-09 19:39:27 -07:00
parent fe21a41532
commit 062f09a000
10 changed files with 159 additions and 46 deletions
+5
View File
@@ -76,6 +76,9 @@ func sendLinuxPressPing() error {
return nil
}
// linuxPressServer holds the HTTP server reference for graceful shutdown.
var linuxPressServer *http.Server
func (a *App) startLinuxPressDaemon() {
mux := http.NewServeMux()
mux.HandleFunc("/press", func(w http.ResponseWriter, r *http.Request) {
@@ -100,7 +103,9 @@ func (a *App) startLinuxPressDaemon() {
Addr: linuxPressAddr,
Handler: mux,
ReadHeaderTimeout: 2 * time.Second,
IdleTimeout: 5 * time.Second,
}
linuxPressServer = server
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
logger.Error("Linux press daemon stopped: %v", err)
}