Suggested API: on_conflict: :replace
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Ruby
- スター
- 2.5k
- フォーク
- 271
- 平均マージ
- 5日 6時間
- マージ済み PR(30日)
- 5
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rails/solid_queue のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
rails/solid_queue#838 ·
メンテナーはふだん 4 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
rails/solid_queue#836 ·
メンテナーはふだん 4 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
rails/solid_queue#834 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
rails/solid_queue#808 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
rails/solid_queue#806 ·
メンテナーはふだん 4 日以内に返信
rails/solid_queue の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
jenkins-infra/jenkins.io#9615 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(ocr): compile the Tesseract-free pipeline with Tokio runtime対応中かも @Goldziher が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
WhatsApp Cloud template sync saves a partial template list when one page of the Graph API response fails対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
simp/pupmod-simp-ssh#270 ·