Better Error handling for empty token list in Messaging send_each_multicast

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

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
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu trong firebase_admin/messaging.py tại send_each_multicast, xung quanh dòng được liên kết, và theo dõi cách một danh sách token thiết bị rỗng đi tới send_each và thread pool. So sánh vị trí thay thế trong send_each. Hoàn thành khi một danh sách rỗng tạo ra một ValueError mang tính mô tả thay vì lỗi max_workers không xác định hiện tại.

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

Mô tả

api: messaging type: feature request

Problem
Non-descriptive error message returned when sending multicast message with empty device token list. Currently the empty list of tokens propagates throughout the code and results in an Unknown Error type with a vague error message as follows: "Unknown error while making remote service calls: max_workers must be greater than 0". This error seems to originate here as the Threadpool is created with max_workers based on the length of the messages parameter, which is ultimately dependent on the number of tokens in the Message object.

Describe the solution you'd like
Check the length of device tokens directly in the send_each_multicast method and return a descriptive ValueError in the event of an empty list. here

Describe alternatives you've considered
Check the length of the message directly in the send_each class method here.

Ngôn ngữ chính
Python
Star
1.2k
Fork
359
Merge trung bình
5 ngày 6 phút
Pull request đã merge (30 ngày)
2

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

Mở 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 firebase/firebase-admin-python

Tất cả issue của firebase/firebase-admin-python

Issue tương tự

Thêm issue về Python

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.