Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Add a method to clear all messages from a channel

Offen
#306 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
php, rabbitmq, redis

Rechercherichtung

Beginne mit dem Lesen von AdapterInterface und den vorhandenen push/status-Einstiegspunkten und untersuche anschließend die Redis-, AMQP- und In-Memory-Adapter. Kläre die Fragen zur Bezeichnung von purge versus clear und zur Kanalsignatur; fertig ist die Aufgabe, wenn die Opt-in-Schnittstelle und die vorgeschlagenen Adapterimplementierungen das Leeren eines Kanals ermöglichen, ohne die primäre Schnittstelle zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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).

Vorherrschende Sprache
PHP
Sterne
61
Forks
31
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
6

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus yiisoft/queue

Alle Issues in yiisoft/queue

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.