Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`InMemoryAdapter` loses the assigned ID between push and consume

Abierto
#342 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
54/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
backend, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
PHP
Estrellas
61
Forks
31
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de yiisoft/queue

Todos los issues de yiisoft/queue

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.