Skip to content

Commit 4c9078c

Browse files
authored
fix(fcm): Increased FCM batch request limit to 500 (#297)
* fix(fcm): Increased FCM batch request limit to 500 * Removed recovery file
1 parent 9877642 commit 4c9078c

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
testdata/integration_*
22
.vscode/*
33
*~
4-
4+
\#*\#

integration/messaging/messaging_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ func TestSendAll(t *testing.T) {
164164
}
165165
}
166166

167-
func TestSendHundred(t *testing.T) {
167+
func TestSendFiveHundred(t *testing.T) {
168168
var messages []*messaging.Message
169-
for i := 0; i < 100; i++ {
169+
const limit = 500
170+
for i := 0; i < limit; i++ {
170171
m := &messaging.Message{
171172
Topic: fmt.Sprintf("foo-bar-%d", i%10),
172173
}
@@ -178,17 +179,17 @@ func TestSendHundred(t *testing.T) {
178179
t.Fatal(err)
179180
}
180181

181-
if len(br.Responses) != 100 {
182-
t.Errorf("len(Responses) = %d; want = 100", len(br.Responses))
182+
if len(br.Responses) != limit {
183+
t.Errorf("len(Responses) = %d; want = %d", len(br.Responses), limit)
183184
}
184-
if br.SuccessCount != 100 {
185-
t.Errorf("SuccessCount = %d; want = 100", br.SuccessCount)
185+
if br.SuccessCount != limit {
186+
t.Errorf("SuccessCount = %d; want = %d", br.SuccessCount, limit)
186187
}
187188
if br.FailureCount != 0 {
188189
t.Errorf("FailureCount = %d; want = 0", br.FailureCount)
189190
}
190191

191-
for i := 0; i < 100; i++ {
192+
for i := 0; i < limit; i++ {
192193
sr := br.Responses[i]
193194
if err := checkSuccessfulSendResponse(sr); err != nil {
194195
t.Errorf("Responses[%d]: %v", i, err)

messaging/messaging_batch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"firebase.google.com/go/internal"
3232
)
3333

34-
const maxMessages = 100
34+
const maxMessages = 500
3535
const multipartBoundary = "__END_OF_PART__"
3636

3737
// MulticastMessage represents a message that can be sent to multiple devices via Firebase Cloud

messaging/messaging_batch_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ func TestSendAllTooManyMessages(t *testing.T) {
189189
}
190190

191191
var messages []*Message
192-
for i := 0; i < 101; i++ {
192+
for i := 0; i < 501; i++ {
193193
messages = append(messages, &Message{Topic: "test-topic"})
194194
}
195195

196-
want := "messages must not contain more than 100 elements"
196+
want := "messages must not contain more than 500 elements"
197197
br, err := client.SendAll(ctx, messages)
198198
if err == nil || err.Error() != want {
199199
t.Errorf("SendAll() = (%v, %v); want = (nil, %q)", br, err, want)
@@ -457,11 +457,11 @@ func TestSendMulticastTooManyTokens(t *testing.T) {
457457
}
458458

459459
var tokens []string
460-
for i := 0; i < 101; i++ {
460+
for i := 0; i < 501; i++ {
461461
tokens = append(tokens, fmt.Sprintf("token%d", i))
462462
}
463463

464-
want := "tokens must not contain more than 100 elements"
464+
want := "tokens must not contain more than 500 elements"
465465
mm := &MulticastMessage{Tokens: tokens}
466466
br, err := client.SendMulticast(ctx, mm)
467467
if err == nil || err.Error() != want {

0 commit comments

Comments
 (0)