firebase / firebase/firebase-admin-python

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
api: messaging type: feature request
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

Mô tả

**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](https://github.com/firebase/firebase-admin-python/blob/master/firebase_admin/messaging.py#L443) 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](https://github.com/firebase/firebase-admin-python/blob/master/firebase_admin/messaging.py#L161)

**Describe alternatives you've considered**
Check the length of the message directly in the send_each class method [here](https://github.com/firebase/firebase-admin-python/blob/32b900b0b7f9d8f453f821bf684bf7023c799808/firebase_admin/messaging.py#L425).

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

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

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.