# sidekiqに300万件以上のエンキューされたジョブが表示されていますが、キューの生成を止めるにはどうすればいいですか？

**URL:** https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542
**Category:** Support
**Created:** [2025 年 1 月 10 日午後 5:43 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542 "2025-01-10T17:43:55Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 1 月 10 日午後 5:43 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/1 "2025-01-10T17:43:55Z")

</div>

それらをすべてきれいにしたばかりなのに、すでに3kです

 ![The image shows a collection of jobs for a chat summary, with details about user IDs and force respect seen recently in settings. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/0/6/0/060d7148916931e34d8c8f0453f85376d9bbfb69.jpeg)

管理ダッシュボードでチャットまたは要約の設定を検索してみましたが、何も見つかりませんでした。

どこから来るのか何かアイデアはありますか？ 😭

追伸：これらのジョブは私のサイトを非常に遅くします 😭

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2025 年 1 月 10 日午後 5:50 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/2 "2025-01-10T17:50:12Z")

</div>

Sidekiq のリトライタブには何がありますか？

 ![画像は、37,170.868 件の処理済みタスク、27,055 件の失敗タスク、6 件のエンキュー済みタスク、4 件のスケジュール済みタスク、4 件のデッドタスクの状態を示しています。(AIによるキャプション)](https://global.discourse-cdn.com/meta/original/4X/8/d/9/8d9ba5c31f34d69e07c3227c95f5ca226beb7d2c.png)

ここでは 6 件のジョブがリトライされています。これは問題ない数であり、その理由もわかっています。

これが 1000 件単位である場合は、問題があり、対処が必要です。

メールログまたはサーバーエラーログ `/logs` にエラーはありますか？

検討事項：

メールサービスプロバイダーがあなたをスロットリングしていませんか？ 契約しているサービスレベルのレート制限を超過していませんか？ プロバイダーへの請求は支払いましたか？

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 1 月 10 日午後 6:04 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/3 "2025-01-10T18:04:24Z")

</div>

![処理済みタスク11,222,546件、スケジュール済み6件、リトライ0件を示すジョブステータスの概要。(AIによるキャプション付き)](https://global.discourse-cdn.com/meta/original/4X/e/0/e/e0ef1d0361e8112739cecdabe1dada1e8762816e.jpeg)

ゼロです。

 ![さまざまなシステムメッセージとエラー通知が表示されたログファイルを示すスクリーンショット。(AIによるキャプション付き)](https://global.discourse-cdn.com/meta/original/4X/8/1/0/8103cee0adc14a93a8ebaead58b8eace1ad3432e.jpeg)

そして、ログにメール関連の問題はないようです。

チャットの概要に関連する設定でオフにできるものはありますか、それともチャットをオフにするべきでしょうか？

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2025 年 1 月 10 日午後 6:06 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/4 "2025-01-10T18:06:39Z")

</div>

キュー全体がほぼUserEmailジョブで構成されていますか？

メールサービスプロバイダーのメールサービスダッシュボード（Discourseではなく）を確認し、そこに情報があるかどうかを確認してください。

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 1 月 10 日午後 6:16 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/5 "2025-01-10T18:16:33Z")

</div>

はい、ほとんどがユーザーメールのジョブです。

Mailgun（アカウントで4つの実行インスタンス）を確認しました。

最初のインスタンスのみがこの問題に遭遇しており、日付は問題ないようです。ログも確認しましたが、特に怪しい点はありませんでした。

 ![メールの承諾率、配信率、バウンス率、開封率、クリック率、苦情率などのさまざまな指標を異なるメールドメインごとに表示する表。(AIによるキャプション)](https://global.discourse-cdn.com/meta/original/4X/d/9/0/d90d5e2d6d69c9028b391d62de722af841d13573.jpeg)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2025 年 1 月 10 日午後 6:19 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/6 "2025-01-10T18:19:56Z")

</div>

監査証跡はありますか、継続的に送信されるメールのチェックオーバーを確認できますか？

最後に送信されたメールは？

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 1 月 10 日午後 6:26 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/7 "2025-01-10T18:26:58Z")

</div>

![メール配信ステータスの表示、すべてのメールが「配信済み」または「承認済み」とマークされ、「OK」または「(...)」というメッセージが表示されているテーブル。(AIによるキャプション)](https://global.discourse-cdn.com/meta/original/4X/9/2/3/923300ddfb7416109b6f0106e67c6a9459dad7e7.jpeg)

このような感じですか？

そして、最後のものは12分前であるべきです

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2025 年 1 月 10 日午後 6:34 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/8 "2025-01-10T18:34:49Z")

</div>

一部は処理されているようですが、十分な速さで処理できていますか？

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 1 月 10 日午後 6:42 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/9 "2025-01-10T18:42:19Z")

</div>

それをどうやって確認すればいいですか？

Discourse（管理/メール/送信済み）でチャット要約メールが1日あたり最大5〜6通、ほとんどの場合は1通かゼロという低い頻度で送信されているのを確認しました。😭 なぜSidekiqでこれほど多くのジョブが作成されるのですか？

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2025 年 1 月 10 日午後 6:43 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/10 "2025-01-10T18:43:25Z")

</div>

メールログを管理画面で確認してください。より明確になるかもしれません。

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 1 月 10 日午後 7:10 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/11 "2025-01-10T19:10:24Z")

</div>

Sidekiq キューの問題は、3.4.0.beta4-dev にアップグレードした直後に発生したことに気づきました。同時期にインストールした別のインスタンスでも同様の問題が発生しているようです（現在確認中です）。

また、ID も確認しましたが、システムはすべてのユーザーにチャットの要約を送信しようとしているようです 🤔  
これは正常ですか？

 ![低優先度の現在のジョブとその引数を表示するテーブル。（AIによるキャプション付き）](https://global.discourse-cdn.com/meta/original/4X/b/2/8/b284f18a1ddcb9e05f9a96a1c66acb7234f8c149.jpeg)

更新：  
チャットをオフにすると、それらのジョブが再度キューイングされるのを防ぐことができますが、私のサイトではチャット機能が必要であり、他の解決策も引き続き調査中です。

さらに更新：  
チャット機能を 2 日間オフにし、再度オンにして、チャットチャンネルの保持期間を 180 日から 3 日に変更しました。これで問題なく動作しているようです。引き続き監視します。

更新 02/01：  
保持期間を 7 日に設定しました。現在、約 1,101,685 件のジョブがエンキューされています。私のサーバーはこの量を処理できるようで、サイトは遅くなりません。

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2025 年 1 月 30 日午後 4:58 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/12 "2025-01-30T16:58:08Z")

</div>

@th21 ユーザーとチャットチャンネルはいくつありますか？

`low` キューはどのくらいの速さ（または遅さ😢）で処理されますか？

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 1 月 30 日午後 5:15 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/13 "2025-01-30T17:15:15Z")

</div>

9k ユーザーと 3 つのチャンネル（デフォルトのスタッフ用チャンネル 1 つを含む）

これが現在の状況です

 ![The image shows a dashboard with 40,301,858 processed items, 40 failed attempts, 5 busy instances, and 5,522 enqueued items across four queues labeled critical, default, low, and ultra_low, sorted by latency and size. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/9/b/8/9b8b336fee13c03fcde7470711d8a5554a1568ba.jpeg)

上記で言及した変更を行う前は、low キューのサイズは決して減少しないように見えました

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2025 年 2 月 3 日午後 5:15 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/14 "2025-02-03T17:15:00Z")

</div>

申し訳ありません、@th21様。それは確かにバグであり、以下のリンクで修正されます。

> <https://github.com/discourse/discourse/pull/31133>
>
> due to an issue with LEFT JOIN, we were enqueue a "chat summary" email for every… new messages in a channel, instead of for every new mentions 😬
> 
> This bloated the sidekiq queue with a lot of unecessary jobs as seen in
> 
> \- https://meta.discourse.org/t/-/347197
> \- https://meta.discourse.org/t/-/346542
> 
> Thankfully, it wasn't sending those emails as the query for listing the unread mentions and dms was correct when generating the chat summary email.

チャットの「未読ユーザー」メンションまたはDMを一覧表示するクエリがありましたが、賢くしようとしすぎた結果、間違ったものになってしまいました。チャンネルでのメンションやDMでの未読の「チャットサマリー」（つまりメール通知）をエンキューする代わりに、すべてのメッセージに対してジョブをエンキューしていました 😑 そのジョブは5分ごとに実行されていたため、簡単にサイドキックを無駄なジョブで肥大化させてしまいました…（注：メンションを取得できなかったため、幸いにもメールは送信されていませんでした）。

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2025 年 2 月 3 日午後 5:29 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/15 "2025-02-03T17:29:32Z")

</div>

ありがとうございます。このコミットがテストに合格してマージされるのはいつ頃の予定ですか？

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2025 年 2 月 3 日午後 5:34 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/16 "2025-02-03T17:34:04Z")

</div>

48時間未満

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2025 年 2 月 4 日午前 9:28 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/17 "2025-02-04T09:28:00Z")

</div>

@th21 確認され、マージされました 👍

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2025 年 3 月 6 日午前 9:28 UTC](https://meta.discourse.org/t/more-then-3-million-enqueued-jobs-show-in-sidekiq-how-to-i-stop-it-generate-the-queue/346542/18 "2025-03-06T09:28:43Z")

</div>

このトピックは、最後の返信から30日後に自動的にクローズされました。新しい返信は許可されていません。
