Skip to content

Commit 53ccbb7

Browse files
committed
fix(qstash): set Upstash-Timeout to 595s on every publish
QStash's default callback delivery timeout is 30s. Ingest jobs that parse + summarize + persist a large PDF (hundreds of sections, each written to S3-compatible storage) reliably exceed that, the webhook gets cut off mid-job, and the engine sees a canceled context just when it's about to mark progress. The 595s ceiling stays under Cloud Run's max request timeout (600s) and matches the longest ingest we've measured.
1 parent 3cb82c1 commit 53ccbb7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pkg/queue/qstash.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ func (q *QStash) Enqueue(ctx context.Context, j Job) error {
113113
}
114114
req.Header.Set("Authorization", "Bearer "+q.cfg.Token)
115115
req.Header.Set("Content-Type", "application/json")
116+
// QStash's default callback delivery timeout is 30s — way too
117+
// short for an ingest job that has to parse + summarize +
118+
// section-store a multi-hundred-page PDF. Set the per-message
119+
// timeout to 9m55s so we stay safely under Cloud Run's max
120+
// request timeout (10m) and never get cut off mid-job.
121+
req.Header.Set("Upstash-Timeout", "595s")
116122
if !j.RunAt.IsZero() {
117123
delay := time.Until(j.RunAt)
118124
if delay > 0 {

0 commit comments

Comments
 (0)