new Reaper({ storage, name }) fails to start because its namespace is never connected
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
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của platformatic/job-queue
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
platformatic/job-queue#54 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
platformatic/job-queue#53 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
platformatic/job-queue#51 ·
Tất cả issue của platformatic/job-queue
Issue tương tự
-
category::task code priority::normal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
e0ipso/strikethroo#145 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
cocos/cocos-docs#3333 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
RevenueCat/react-native-purchases#2079 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
RevenueCat/purchases-hybrid-common#2039 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-reported area/react bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày