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

Infinite Loop

Đang mở
#4 4 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
postgresql, typescript
Lĩnh vực
backend, databases

Hướng nghiên cứu

Start at the createQueue(...).start() entry point and reproduce the behavior with the shown emailQueue.start() call and job handler. Inspect the worker's job lifecycle and database state after a job succeeds or throws. Done means the job is handled according to its outcome, is not repeatedly reported as absent, and the background worker remains usable.

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

Mô tả

Hey! My project uses prisma and this looked pretty convenient so I wanted to give it a shot.

I'm facing an issue where the worker is getting stuck in an infinite loop. As soon as I add a job, it prints out an infinite amount of:

2024-06-14T06:50:14.123Z prisma-queue processing job from queue named="email"...
2024-06-14T06:50:14.123Z prisma-queue dequeuing from queue named="email"...
2024-06-14T06:50:14.124Z prisma-queue no jobs found in queue named="email"
2024-06-14T06:50:14.174Z prisma-queue processing job from queue named="email"...
2024-06-14T06:50:14.174Z prisma-queue dequeuing from queue named="email"...
2024-06-14T06:50:14.175Z prisma-queue no jobs found in queue named="email"

I noticed that in the DB, the job is not being removed. NOTE: I'm not awaiting the .start()

Code:

export const emailQueue = createQueue<JobPayload, JobResult>(
  { name: 'email' },
  async (job, client) => {
    const { id, payload } = job;
    console.log(
      `Processing job#${id} with payload=${JSON.stringify(payload)})`,
    );
    // await someAsyncMethod();
    await job.progress(50);
    const status = 200;
    if (Math.random() > 0.5) {
      throw new Error(`Failed for some unknown reason`);
    }
    console.log(`Finished job#${id} with status=${status}`);
    return { status };
  },
);

void emailQueue.start();

My use case is I'm running Next.js in a container and just want this to run in the background. So I just put the void emailQueue.start() so that it does it in the background. This strategy seems to work with pgboss

Ngôn ngữ chính
TypeScript
Star
61
Fork
9
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 mgcrea/prisma-queue

Tất cả issue của mgcrea/prisma-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.