cakephp / cakephp/queue

Issue with multiple consumers - re-delivering in progress jobs

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

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

bug
Ngôn ngữ chính
PHP
Star
36
Fork
22
Merge trung bình
20 giờ 36 phút
Pull request đã merge (30 ngày)
2

Mô tả

Hello,

I'm not sure if I have found a bug or if this just a case of user error.

I am having an issue with running multiple workers on long running jobs (~20 minutes).

When add a message into the queue and then start 2 workers using the following command
bin/cake worker -c process-invoices -p process-invoices

Initially, 1 worker will begin to process the job. However, after about 5 minutes, the other worker also begins to start working on the same job.

I have set $maxAttempts = 1 in the job class.

Next, I tried to bind each processor to an unique name
bin/cake worker -c process-invoices -p process-invoices1
and
bin/cake worker -c process-invoices -p process-invoices2

The message is only picked up by 1 worker, however if another message gets added to the queue, the other worker receives the following error:

[LogicException] Processor was not found. processorName: "process-invoices2" in /var/www/html/vendor/enqueue/enqueue/ArrayProcessorRegistry.php on line 33

And when I don't bind the processor name and run the following command twice to create 2 workers
bin/cake worker -c process-invoices

I receive a similar error:

error: [LogicException] Processor was not found. processorName: "Cake\Queue\Queue\Processor63e2a1884f1c4" in /var/www/html/vendor/enqueue/enqueue/ArrayProcessorRegistry.php on line 33

For reference, the config for the queue is:

'Queue' => [
    'process-invoices' => [
        'url' => null,
        'queue' => 'process-invoices',
        'logger' => 'stdout',
        'receiveTimeout' => 10000,
        'storeFailedJobs' => true,
    ],
],

I am unable to figure out a method of having multiple workers without the errors or re-processing jobs.
Is there any config setting (visibility timeout) that I am missing to resolve my issues?

Thanks!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện vấn đề với hai tiến trình worker bin/cake bằng cấu hình process-invoices và một job chạy trong thời gian dài. Đọc điểm vào của worker và lỗi ArrayProcessorRegistry.php được báo cáo, sau đó so sánh hành vi với các tên processor duy nhất và được dùng chung. Hoàn thành có nghĩa là nhiều worker có thể xử lý các job đang xếp hàng mà không bị phân phối lại hoặc gặp lỗi Processor was not found.

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

Đánh giá

Công nghệ
php
Lĩnh vực
backend, distributed-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

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.