Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#52 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
postgresql, redis, typescript
Lĩnh vực
backend, databases

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
371
Fork
11
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của platformatic/job-queue

Tất cả issue của platformatic/job-queue

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.