app:url:download crashes with MissingIdentifierField after the download process stops

Đang mở Phù hợp với người mới
#54 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
69/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend, cli

Hướng nghiên cứu

Bắt đầu với ProcessStoppedListener.php, đặc biệt là onCliProcessStopEvent() và lời gọi find($event->downloadJob->getId()) được mô tả trong issue. Theo dõi cách UrlDownloadCommand tạo DownloadJob và kiểm tra các bài kiểm thử listener hiện có. Xác minh rằng chạy lệnh kết thúc thành công và có bài kiểm thử bao quát một job chưa được lưu trữ.

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

Mô tả

bug good first issue

Problem

bin/console app:url:download <url> crashes after the first yt-dlp run. Found while testing #46 / #52:

[Doctrine\ORM\Exception\MissingIdentifierField]
The identifier id is missing for a query of App\Entity\DownloadJob

  at ProcessStoppedListener.php:38  ($this->downloadJobRepository->find($event->downloadJob->getId()))
  ... AbstractCliDownloader->runDownloadProcess()
  ... UrlDownloadCommand->execute()

UrlDownloadCommand creates a DownloadJob that is never persisted (id is null). ProcessStoppedListener::onCliProcessStopEvent() calls find(null) on it, which throws. The download itself happens, but the command exits with an error, and since #52 the retry without the download archive never runs from this command.

Proposed fix

Either:

  • Guard the listener: skip the database work in ProcessStoppedListener when the job has no id (null === $event->downloadJob->getId()). The command stays a "download only, don't record" tool.
  • Persist the job in the command: save the job (with downloader and state) before downloading, so CLI downloads behave like API downloads and get events and linked files.

The guard is the smaller fix. Persisting may be preferable if CLI downloads should show up in the admin panel.

Verification

bin/console app:url:download --downloader yt-dlp-cli <url> exits with 0, and a test covering the listener with an unpersisted job.

Ngôn ngữ chính
PHP
Star
1
Fork
0
Merge trung bình
3 ngày 50 phút
Pull request đã merge (30 ngày)
9

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

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 FetchDock/fetchdock-server

Tất cả issue của FetchDock/fetchdock-server

Issue tương tự

Thêm issue về PHP

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.