Suggested API: on_conflict: :replace
Maintainer thường phản hồi trong vòng 4 ngày
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
The payload names no files or tests. Start from the existing on_conflict: :discard path used by limits_concurrency, then trace how a pending job is stored and identified by its concurrency key. Decide the semantics for :replace and whether payload batching is included, then add coverage for first-wins versus last-wins behavior. Done means the new option is implemented, documented, and tested for duplicate enqueues while a matching job is still waiting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Currently, Solid Queue provides an on_conflict: :discard option to enforce uniqueness. This follows a "first wins" behavior, where subsequent duplicate jobs are dropped if a matching job is already pending in the queue.
However, many use cases (such as syncing the latest user state or syncing inventory) require a "last value wins" strategy. If a new job with the exact same concurrency key is enqueued while a previous one is still waiting, the queue should ensure that only the latest job (carrying the freshest payload) is processed. This can be achieved either by replacing the pending job entirely or updating its payload.
Introducing this strategy would also significantly boost performance under high-frequency updates, as it prevents the system from wasting database and worker cycles processing outdated intermediate payloads.
Examples from other queue managers
• Sidekiq Enterprise / Sidekiq Unique Jobs: Supports options like on_conflict: :replace or rescheduling to overwrite the payload of an un-executed job with the freshest data.
• Lowkiq: Passes an array of all enqueued payloads directly to the perform method, allowing the developer to decide how to process or batch them.
Suggested API
It would be useful to introduce a configuration option to define how concurrency conflicts are handled:
Option A: Pure :replace strategy
class UpdateInventoryJob < ApplicationJob
limits_concurrency to: 1, key: ->(payload) { payload.id }, on_conflict: :replace
def perform(payload)
# ...
end
end
Option B: Custom conflict hook with payload batching
class UpdateInventoryJob < ApplicationJob
limits_concurrency to: 1, key: ->(product) { product.id }, on_conflict: :replace
def perform_on_conflict(payloads)
# Allows manually processing the final state
perform(payloads.last)
end
end
- Ngôn ngữ chính
- Ruby
- Star
- 2.5k
- Fork
- 271
- Merge trung bình
- 5 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
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 rails/solid_queue
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rails/solid_queue#838 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
rails/solid_queue#836 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
rails/solid_queue#834 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
rails/solid_queue#808 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
rails/solid_queue#806 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của rails/solid_queue
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
jenkins-infra/jenkins.io#9615 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(ocr): compile the Tesseract-free pipeline with Tokio runtimeCó thể đã có người làm @Goldziher đã 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
Maintainer thường phản hồi trong vòng 1 ngày
-
WhatsApp Cloud template sync saves a partial template list when one page of the Graph API response failsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Remove the tcpwrappers assertion that can no longer fail from the simp:defaults profile specĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
simp/pupmod-simp-ssh#270 ·