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:
parent
e60ec521e1
commit
708dc5fda9
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user