Is your feature request related to a problem? Please describe.
Messaging#sendEach makes an HTTP request for each message. The problem is that it attempts to retrieve a token for each request. Although the tokens are cached internally, the requests are processed concurrently, so the cached value cannot be used, leading to a burst of unnecessary token fetch requests.
Describe the solution you'd like
Instead of attempting to retrieve a token for each request, a token should be obtained before sending the requests and then injected into each send request.
Describe alternatives you've considered
Additional context
Add a token: string parameter to FirebaseMessagingRequestHandler#invokeHttp2RequestHandlerForSendResponse and include it when creating the request object.
Inside AuthorizedHttp2Client#send, remove the getToken call and instead find and add the token from the request object passed as a parameter.
Is your feature request related to a problem? Please describe.
Messaging#sendEachmakes an HTTP request for each message. The problem is that it attempts to retrieve a token for each request. Although the tokens are cached internally, the requests are processed concurrently, so the cached value cannot be used, leading to a burst of unnecessary token fetch requests.Describe the solution you'd like
Instead of attempting to retrieve a token for each request, a token should be obtained before sending the requests and then injected into each send request.
Describe alternatives you've considered
Additional context
Add a
token: stringparameter toFirebaseMessagingRequestHandler#invokeHttp2RequestHandlerForSendResponseand include it when creating the request object.Inside
AuthorizedHttp2Client#send, remove thegetTokencall and instead find and add the token from the request object passed as a parameter.