can't configure RescueStuckJobsAfter for an individual job
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start by reading the InsertTx and InsertOpts paths and the handling of scheduled_time in the jobs table. Review the linked issues 336 and 165 plus discussion 346 to understand the existing uniqueness and worker-abandonment behavior. Done would require a decided, testable scope for per-job rescue or deadline handling, which this issue does not yet define.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
we have some jobs that take 1-2 minutes, and other jobs that takes at most 5 seconds, and so we set worker timeouts accordingly
however, we can't configure RescueStuckJobsAfter for an individual job. this means that when a worker running the 5 seconds task dies, we need to wait for the global RescueStuckJobsAfter, instead of what should be 5-10 seconds. this means that updates that should be happening around once a second pause for a few minutes instead of a few seconds.
we schedule with a unique constraint because this task runs on every event, but sometimes events can be up to 10 per second, and we are okay with not scheduling the task if it is already running since it is an aggregate and will just be picked up on the next unique task. if we schedule too many jobs, we will not only schedule more than we can process, but be doing extra work, and need to worry about race conditions where tasks that started earlier finish later.
one possible solution is to read the jobs table during InsertTx, and check using scheduled_time if the job is stuck ourselves, and manually fix it, but i'm not sure if that's allowed. for now i am checking the scheduled_time in a loop in my go application to manually rescue the task as this one specific task is critical to the movement of the rest of the applications.
a deadline feature in InsertOpts i think would make me really happy, as it would also resolve other issues im having to work around. workers should discard jobs that they pick up that are past their deadline, and a maintenance job which "discards" tasks that are after their deadline could run on a regular interval.
the problem is adjacent to something that @bgentry mentioned in a previous reply to me in https://github.com/riverqueue/river/issues/336#issuecomment-2093895895 . This is actually a different summary job in a different app, we deal with a lot of data that needs to be updated in this manner.
It also sounds like you’re looking to ensure that only one of these summary jobs is running at a given moment. This is also something there’s no official support for, though you can hack it in with your own locking mechanism. However it’s something we have thought about and hope to implement.
we have had success using some hacky locking mechanisms for our other tasks, however in this case we are trying using the job=running as our locking mechanism, and the issue is that it takes too long for a dying worker to "abandon" their lock.
for reference, the system we are migrating from used a user defined hash as an optional uniqueness key with support for a job timeout and deadline on the job level. the key would be locked when scheduled, and unlocked at deadline or job completion. we could bring that idea back and use it along with river.
this calls back to what i was told to do here: https://github.com/riverqueue/river/discussions/346
and also very much relates to this problem: https://github.com/riverqueue/river/issues/165
In your case, an alternative: drop the uniqueness checks and then implement your job such that it checks on start up the last time its data was updated. If the update was very recent, it falls through with a no op. So you'd still be inserting lots of jobs, but most of them wouldn't be doing any work, and you wouldn't suffer the unique performance penalty.
just checking if the job is running using my own locks table.
that said, these restrictions + the incredibly slow insert speed (100-200rps) with unique makes me feel like the current "unique constraint" feature is missing a lot of power.
I am feeling like my best course of action at this point given the current state of Unique to move forward with river is to build a layer on top of river that deals a little better with these more complex scheduling constraints.
- Ngôn ngữ chính
- Go
- Star
- 5.7k
- Fork
- 179
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 12
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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ó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
riverqueue/river#1358 · 1 bình luận ·
-
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 ·
-
Độ 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 ·
-
Độ 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 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
riverqueue/river#1183 · 2 reaction ·
Tất cả issue của riverqueue/river
Issue tương tự
-
area/dev-productivity area/disaster-recovery area/ipcei kind/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
kind/bug status/0-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
🤔 refinement needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
equinor/radix-operator#1979 ·