Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add a method to clear all messages from a channel

Aperta
#306 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
php, rabbitmq, redis

Direzione di ricerca

Inizia leggendo AdapterInterface e gli entry point esistenti di push/status, quindi esamina gli adapter Redis, AMQP e in-memory. Risolvi le questioni relative ai nomi purge rispetto a clear e alla firma del canale; il lavoro è completato quando l’interfaccia opt-in e le implementazioni degli adapter proposte supportano lo svuotamento di un canale senza modificare l’interfaccia primaria.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
PHP
Stelle
61
Fork
31
Merge medio
1g 7h
PR unite (30g)
9

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di yiisoft/queue

Tutte le issue di yiisoft/queue

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.