fix: use context.Background() ao enfileirar jobs

O contexto da requisição HTTP era passado para o Enqueue, causando
'context canceled' quando a conexão encerrava antes do INSERT no
SQLite completar. Jobs devem ser persistidos independentemente do
ciclo de vida da requisição.
This commit is contained in:
Rodrigo Verdiani 2026-07-07 08:43:20 -03:00
parent e60ec521e1
commit 708dc5fda9
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package web
import (
"context"
"encoding/json"
"log/slog"
"net/http"
@ -107,7 +108,7 @@ func (h *Handler) LibraryConvert(w http.ResponseWriter, r *http.Request) {
album := filepath.Base(absPath)
artist := filepath.Base(filepath.Dir(absPath))
id, err := h.enqueuer.Enqueue(r.Context(), jobs.EnqueueInput{
id, err := h.enqueuer.Enqueue(context.Background(), jobs.EnqueueInput{
Artist: artist,
Album: album,
Path: absPath,

View File

@ -1,6 +1,7 @@
package webhook
import (
"context"
"encoding/json"
"fmt"
"log/slog"
@ -89,7 +90,7 @@ func (h *Handler) Handle(w http.ResponseWriter, r *http.Request) {
return
}
id, err := h.enqueuer.Enqueue(r.Context(), jobs.EnqueueInput{
id, err := h.enqueuer.Enqueue(context.Background(), jobs.EnqueueInput{
Artist: payload.Artist.Name,
Album: payload.Album.Title,
Path: resolved,