Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add a method to clear all messages from a channel

オープン
#306 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
php, rabbitmq, redis

調査の方向性

まず AdapterInterface と既存の push/status エントリポイントを読み、次に Redis、AMQP、インメモリのアダプターを調査します。purge と clear の命名、およびチャネルシグネチャに関する問題を解決してください。opt-in インターフェースと提案されたアダプター実装によって、プライマリインターフェースを変更せずにチャネルを空にできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Proposed new feature or change

There's no programmatic way to empty a queue. It comes up in three places:

  1. Maintenance - a queue:purge command or an admin button to drop a queue that got flooded with poison pills or jobs that are no longer wanted.
  2. Deployments - clearing a queue during a release when the payload structure changed and old queued jobs would crash on the new code.
  3. Testing - resetting state between runs. Shelling out to redis-cli or rabbitmqctl makes the test suite fragile and awkward to run in containerized CI.

I wouldn't put this on AdapterInterface - that would break every existing implementation and it overlaps with the "not the job of the primary interface" point from #271. A separate opt-in interface fits better:

interface PurgeableInterface
{
    public function purge(): void;
}

Adapters implement it when the backend can do it cheaply (Redis drops the channel keys, AMQP calls queue_purge, the in-memory adapter resets its array). Callers check for it:

if ($adapter instanceof PurgeableInterface) {
    $adapter->purge();
}

Open questions:

  1. Name: purge() (broker vocabulary) or clear()?
  2. Signature: purge(): void on the adapter's current channel (consistent with push/status, which don't take a channel) or purge(string $channel)?

Worth pursuing? Happy to send a PR if you're good with it (core + redis/amqp).

主要言語
PHP
スター
61
フォーク
31
平均マージ
1日 7時間
マージ済み PR(30日)
9

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

yiisoft/queue のほかの issue

yiisoft/queue の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。