Job cancellation doesn't work in database/sql driver
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Reproduce the issue with the SortWorker example, riverui's Cancel action, and riverdatabasesql.New using the described pgx and ocsql setup. Start by tracing cancellation from the cancel_attempted_at metadata to the Work context; done means the worker observes ctx.Done, logs CANCELLED, and stops before the 20-second delay.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi!
I am using the example SortWorker job with small adjustments to test longer-running jobs with cancellation but it does not seem to work.
const SortJobKind = "sort"
type SortArgs struct {
Strings []string `json:"strings"`
}
func (SortArgs) Kind() string {
return SortJobKind
}
type SortWorker struct {
river.WorkerDefaults[SortArgs]
}
func (w *SortWorker) Work(ctx context.Context, job *river.Job[SortArgs]) error {
log.Printf("STARTING: %d", job.ID)
select {
case <-ctx.Done():
log.Printf("CANCELLED: %d", job.ID)
return ctx.Err()
case <-time.After(20 * time.Second):
log.Printf("WILL DO: %d", job.ID)
}
items := job.Args.Strings
sort.Strings(items)
log.Printf("RESULT: %+v\n", items)
return nil
}
When the job appears in the User Interface (riverui), I click Cancel but the job keeps running. In the logs I eventually get from STARTING to WILL DO but never observe CANCELLED.
The only thing that indicates some attempt at cancellation is the metadata field on the job which states:
{
"cancel_attempted_at": "2024-10-02T....."
}
Am I doing something wrong or is there a potential bug?
I am running v0.12.1 and using riverdatabasesql.New, though the underlying connection is pgx, wrapped with opencensus tracing (ocsql).
- Ngôn ngữ chính
- Go
- Star
- 6k
- Fork
- 210
- Merge trung bình
- 12 giờ 2 phút
- Pull request đã merge (30 ngày)
- 24
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của riverqueue/river
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
riverqueue/river#1608 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
riverqueue/river#1599 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
River job stuck at runningĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
riverqueue/river#1258 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
riverqueue/river#1225 · 14 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
riverqueue/river#1185 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của riverqueue/river
Issue tương tự
-
ConcatAgenticMessages loses the approval request ID of a streamed MCP tool callCó thể đã có người làm @ningsiyuan1024 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
containers/gvisor-tap-vsock#796 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
external needs:triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
celestiaorg/celestia-node#5448 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsCó thể đã có người làm @huanghaoyuanhhy đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zilliztech/milvus-backup#1418 ·
Maintainer thường phản hồi trong vòng 1 ngày