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

new Reaper({ storage, name }) fails to start because its namespace is never connected

Abierto
#52 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
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
postgresql, redis, typescript

Línea de trabajo

Start with src/reaper.ts, especially the constructor and start()/stop() lifecycle, then compare it with Queue.start(), which connects its created namespace. Verify the named Reaper path for both RedisStorage and PgStorage, including cleanup after a failed start; done means start succeeds and stop disconnects the internally created namespace.

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

Descripción

new Reaper({ storage, name }) creates a namespace from storage but never connects it, so start() fails on the first storage call. Named queues can't be paired with a Reaper unless you connect the namespace yourself and pass it without name.

Reproduction

@platformatic/[email protected] (also on main), with Redis on localhost:

import { RedisStorage, Reaper } from '@platformatic/job-queue'

const storage = new RedisStorage({ url: 'redis://localhost:6379' })
await storage.connect()

const reaper = new Reaper({ storage, name: 'emails' })
try {
  await reaper.start()
  console.log('started')
} catch (err) {
  console.log('reaper.start() failed:', err.message)
} finally {
  await reaper.stop()
  await storage.disconnect()
}

Output:

reaper.start() failed: Cannot read properties of null (reading 'subscribe')

With PgStorage, subscribing succeeds and start() then fails in getWorkers() with Cannot read properties of null (reading 'query').

Cause

The constructor does config.storage.createNamespace(config.name) (reaper.ts#L66), but neither start() nor stop() connects or disconnects that namespace. Queue also creates its namespace in the constructor, but calls storage.connect() in start(). No test currently uses a named Reaper.

Suggested fix

When the Reaper created the namespace itself, connect it at the start of start() (before subscribing or leader election) and disconnect it in stop(). If start() fails, clean up and reset the running flag so it can be retried.

I'm happy to send a PR for this.

Lenguaje dominante
TypeScript
Estrellas
371
Forks
11
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

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 platformatic/job-queue

Todos los issues de platformatic/job-queue

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.