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

`InMemoryAdapter` loses the assigned ID between push and consume

Aperta
#342 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend, testing

Direzione di ricerca

Read stubs/InMemoryAdapter.php, especially the push() implementation around lines 44–46, and trace how Worker::process() consumes messages. Check the logging middleware described in performance-tuning.md and the related behavior in issue #341. Confirm the adapter retains the assigned ID through consumption, and that the handler’s envelope behavior matches the intended interaction.

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

Descrizione

InMemoryAdapter::push() stores the original message and returns the IdEnvelope only to the caller:

$id = count($this->messages) + $this->current;
$this->messages[] = $message;          // stubs/InMemoryAdapter.php:44

return new IdEnvelope($message, $id);  // stubs/InMemoryAdapter.php:46

So the id exists for whoever called push(), and nowhere else:

push() returned:   IdEnvelope id=0
stored in adapter: GenericMessage meta=[]

INFO: Pushed message with message type "probe" to the queue. Assigned ID #0.
INFO: Processing message without ID.

Anything reading the id at consume time gets null for every message that went through this adapter — Worker::process() itself, and the logging middleware the guide suggests in performance-tuning.md. Meanwhile status($id) does answer for that id, so the two halves of the adapter disagree about whether the message has one.

Storing the envelope instead ($this->messages[] = new IdEnvelope($message, $id)) would make them agree, and would make the stub behave like an adapter that persists what it returns.

Note this interacts with #341: once the envelope is what gets stored, the handler starts receiving an IdEnvelope on the in-memory path too, which is the behaviour that issue is about.

Lingua principale
PHP
Stelle
60
Fork
32
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

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.