Skip to content

fix: remove artificial 500 message limit from sendEach#1222

Open
ezhilnn wants to merge 1 commit into
firebase:mainfrom
ezhilnn:fix/remove-sendEach-500-limit
Open

fix: remove artificial 500 message limit from sendEach#1222
ezhilnn wants to merge 1 commit into
firebase:mainfrom
ezhilnn:fix/remove-sendEach-500-limit

Conversation

@ezhilnn

@ezhilnn ezhilnn commented Jun 22, 2026

Copy link
Copy Markdown

Fixes #1103
#1103

Problem

sendEach makes an individual HTTP call per message, unlike the
deprecated sendAll which used a single HTTP batch request limited
by Google's batch API. The 500-message cap was copied from sendAll
where it was technically justified — but has no basis in sendEach.

Changes

  • Removed the 500-message hard limit from sendEachOpAsync
  • Updated Javadoc on sendEach and sendEachAsync methods to advise
    callers to chunk very large lists to avoid FCM server-side rate limiting

Testing

  • Removed test asserting 500+ messages throws an exception
  • Added test confirming 501+ messages are accepted

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the 500-message limit from the sendEach and sendEachForMulticast methods in FirebaseMessaging, updating Javadocs and tests accordingly. A critical issue was identified in the new unit test where calling FirebaseMessaging.getInstance() without initializing FirebaseApp throws an IllegalStateException that is silently caught, resulting in a false positive test. It is recommended to use a mock client to properly verify the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FirebaseMessaging.sendEach has a limit of 500 messages

1 participant