-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Async Overhead in SendBatchNotificationAsync:
In the SendBatchNotificationAsync method, you are awaiting the completion of sending each notification individually. This can lead to increased overhead due to the continuous waiting for each send operation to complete.
Recommendation: If sending each notification doesn't require a dependency on the result of the previous one, consider using Task.WhenAll to await the completion of all send operations simultaneously. This can improve the efficiency of handling multiple sends concurrently.
...\src\AdsPush.Firebase\FirebasePushNotificationSender.cs
public async Task SendBatchNotificationAsync(
IEnumerable notifications,
CancellationToken cancellationToken = default)
{
var result = await this._firebaseMessaging.SendAllAsync(notifications, cancellationToken);
return new FirebaseNotificationBatchResult(result.Responses.Select(FirebaseNotificationResult.CreateUsingFirebaseSendResponse).ToList());
}