duplicate messages when using send batch of messages

オープン
#372 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
csharp
領域
api, backend

調査の方向性

sendEachAsync のドキュメントから始め、示されている SendMultiNotiV2 のバッチ処理ループと比較します。特に、メッセージがどのようにクリアされ、再試行されるかを確認してください。報告されている Firebase Admin .NET SDK 2.4.0 の環境で 500 メッセージのバッチを再現し、その後、重複が SDK に起因するのか呼び出し側のコードに起因するのかを判断して、確認された動作を記録してください。

索引モデルが issue の本文から書いたものです。

説明

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();
                                  
                                }
                            }
                        }
主要言語
C#
スター
407
フォーク
147
平均マージ
1日 3時間
マージ済み PR(30日)
10

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/firebase-admin-dotnet のほかの issue

firebase/firebase-admin-dotnet の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。