Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SendEach, SendEachDryRun, SendEachForMulticast, #544

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

Doris-Ge
Copy link
Contributor

SendEachForMulticastDryRun

  1. Add SendEach, SendEachDryRun, SendEachForMulticast, SendEachForMulticastDryRun
  2. Deprecate SendAll, SendAllDryRun, SendMulticast, SendMulticastDryRun

SendEach vs SendAll

  1. SendEach sends one HTTP request to V1 Send endpoint for each message in the array. SendAll sends only one HTTP request to V1 Batch Send endpoint to send all messages in the array.
  2. SendEach calls fcmClient.Send to send each message and constructs a SendResponse with the returned message id or error. SendEach uses sync.WaitGroup to execute all fcmClient.Send calls asynchronously and wait for all of them to complete and construct a BatchResponse with all SendResponses. Therefore, unlike SendAll, SendEach does not always returns an error for a total failure. It can also return a BatchResponse with only errors in it.

SendEachForMulticast calls SendEach under the hood.

Will send the integration tests in another PR.

Copy link
Member

@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

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

Thanks @Doris-Ge ! Looks great.

messaging/messaging_batch.go Outdated Show resolved Hide resolved
messaging/messaging_batch.go Outdated Show resolved Hide resolved
@lahirumaramba
Copy link
Member

Please make sure that this branch is based off of dev and not mater. In the Go repo, we make all the new changes in the dev branch and only the releases are merged to the main (master) branch. Thank you!

@Doris-Ge
Copy link
Contributor Author

Please make sure that this branch is based off of dev and not mater. In the Go repo, we make all the new changes in the dev branch and only the releases are merged to the main (master) branch. Thank you!
Thanks for letting me know that!
I tried git push but it always got rejected, so I created a PR to merge dev into this branch because dev is only one commit ahead of this branch.

`SendEachForMulticastDryRun`

1. Add `SendEach`, `SendEachDryRun`, `SendEachForMulticast`,
   `SendEachForMulticastDryRun`
2. Deprecate `SendAll`, `SendAllDryRun`, `SendMulticast`,
   `SendMulticastDryRun`

`SendEach` vs `SendAll`
1. `SendEach` sends one HTTP request to V1 Send endpoint for each
    message in the array.
   `SendAll` sends only one HTTP request to V1 Batch Send endpoint
    to send all messages in the array.
2. `SendEach` calls fcmClient.Send to send each message
    and constructs a SendResponse with the returned message id or error.
    `SendEach` uses sync.WaitGroup to execute all fcmClient.Send calls
    asynchronously and wait for all of them to complete and construct a
    BatchResponse with all SendResponses.
    Therefore, unlike `SendAll`, `SendEach` does not always returns
    an error for a total failure. It can also return a `BatchResponse`
    with only errors in it.

`SendEachForMulticast` calls `SendEach` under the hood.
@Doris-Ge Doris-Ge force-pushed the remotes/dorisge/fcm-send-batch branch from 9d24429 to 4ffa38f Compare March 28, 2023 23:04
@Doris-Ge Doris-Ge merged commit 6e9cd91 into fcm-batch-send Mar 28, 2023
Doris-Ge added a commit that referenced this pull request Apr 5, 2023
`SendEachForMulticastDryRun`

1. Add `SendEach`, `SendEachDryRun`, `SendEachForMulticast`,
   `SendEachForMulticastDryRun`
2. Deprecate `SendAll`, `SendAllDryRun`, `SendMulticast`,
   `SendMulticastDryRun`

`SendEach` vs `SendAll`
1. `SendEach` sends one HTTP request to V1 Send endpoint for each
    message in the array.
   `SendAll` sends only one HTTP request to V1 Batch Send endpoint
    to send all messages in the array.
2. `SendEach` calls fcmClient.Send to send each message
    and constructs a SendResponse with the returned message id or error.
    `SendEach` uses sync.WaitGroup to execute all fcmClient.Send calls
    asynchronously and wait for all of them to complete and construct a
    BatchResponse with all SendResponses.
    Therefore, unlike `SendAll`, `SendEach` does not always returns
    an error for a total failure. It can also return a `BatchResponse`
    with only errors in it.

`SendEachForMulticast` calls `SendEach` under the hood.
Doris-Ge added a commit that referenced this pull request Apr 21, 2023
* Implement `SendEach`, `SendEachDryRun`, `SendEachForMulticast`, (#544)

`SendEachForMulticastDryRun`

1. Add `SendEach`, `SendEachDryRun`, `SendEachForMulticast`,
   `SendEachForMulticastDryRun`
2. Deprecate `SendAll`, `SendAllDryRun`, `SendMulticast`,
   `SendMulticastDryRun`

`SendEach` vs `SendAll`
1. `SendEach` sends one HTTP request to V1 Send endpoint for each
    message in the array.
   `SendAll` sends only one HTTP request to V1 Batch Send endpoint
    to send all messages in the array.
2. `SendEach` calls fcmClient.Send to send each message
    and constructs a SendResponse with the returned message id or error.
    `SendEach` uses sync.WaitGroup to execute all fcmClient.Send calls
    asynchronously and wait for all of them to complete and construct a
    BatchResponse with all SendResponses.
    Therefore, unlike `SendAll`, `SendEach` does not always returns
    an error for a total failure. It can also return a `BatchResponse`
    with only errors in it.

`SendEachForMulticast` calls `SendEach` under the hood.

* Add integration tests for `SendEach` and `SendEachForMulticast` (#550)

* Avoid using "-- i.e." in the function comments

* Remove all backticks in messaging_batch.go
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.

None yet

2 participants