mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 21:01:08 +02:00
fix(crawler): use background context for crawl jobs (outlive HTTP request)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b0009c200b
commit
3e2558a63a
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
|
@ -89,8 +90,8 @@ func (h *Handler) StartCrawl(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// Start crawl
|
||||
if err := h.crawler.StartJob(r.Context(), jobID, body.StartURL, cfg); err != nil {
|
||||
// Start crawl (use background context so it outlives the HTTP request)
|
||||
if err := h.crawler.StartJob(context.Background(), jobID, body.StartURL, cfg); err != nil {
|
||||
writeJSON(w, http.StatusInternalServerError, map[string]string{"error": "failed to start crawl"})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue