Skip to content

use Task.WhenAll to await the completion of all send operations simultaneously.  #8

@aykut-aktas-covergo

Description

@aykut-aktas-covergo

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());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions