duplicate messages when using send batch of messages

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

Hướng nghiên cứu

Bắt đầu với tài liệu sendEachAsync và so sánh tài liệu đó với vòng lặp batching SendMultiNotiV2 được hiển thị, đặc biệt là cách các message được xóa và thử lại. Tái hiện các batch 500 message với môi trường Firebase Admin .NET SDK 2.4.0 được báo cáo, sau đó xác định liệu các bản trùng lặp đến từ SDK hay từ code gọi, và ghi lại hành vi đã được xác nhận.

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

Mô tả

api: messaging
[READ] Step 1: Are you in the right place?
  • For issues related to the code in this repository file a Github issue.
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.
[REQUIRED] Step 2: Describe your environment
  • Operating System version: window 10 (19045)
  • Firebase SDK version: 2.4.0 with VS2019
  • Firebase Product: messaging (auth, database, storage, etc)
  • .NET version: 4.6.1
  • OS: windows dotnet
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:

When I send a list of messages using sendEachAsync method with data read all info from my DB (about 10000 users) and loop each 500 record and send batch then received duplicate messages.

I using code follow in doc:
https://firebase.google.com/docs/cloud-messaging/send-message

Relevant Code:

if (FirebaseApp.DefaultInstance == null)
{
FirebaseApp.Create(new AppOptions()
{
Credential = GoogleCredential.FromFile(Server.MapPath(ConfigurationManager.AppSettings["FCMKey"]))
});
}

var messages = new List()
int cnt = 0;
foreach (DataRow item in iResult.CursorData.Rows)
{
cnt++;

                            messages.Add(new Message()
                            {
                                Notification = new Notification()
                                {
                                    Title = item["title"].ToString(),
                                    Body = item["DESCRIPTION"].ToString()
                                },
                                Token = item["GCMID"].ToString()
                            });
                           
                            if (cnt == 500 || cnt==iResult.CursorData.Rows.Count)
                            {
                                try
                                {
                                   
                                    string Obj = fcm.SendMultiNotiV2(messages);
                                    messages.Clear();
                                    
                                }
                                catch (Exception ex)
                                {
                                    messages.Clear();                                        
                                }
                                finally
                                {
                                    cnt = 0;
                                    messages.Clear();
                                  
                                }
                            }
                        }
Ngôn ngữ chính
C#
Star
407
Fork
147
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
12

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 firebase/firebase-admin-dotnet

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

Issue tương tự

Thêm issue về C#

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.