From 7fb199b187f87f394034440c928c2deb7b50d52a Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 16 Aug 2025 00:03:41 +0800 Subject: [PATCH] :bug: Make send notification await --- DysonNetwork.Pusher/Notification/PushService.cs | 7 +++---- DysonNetwork.Pusher/Services/PusherServiceGrpc.cs | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/DysonNetwork.Pusher/Notification/PushService.cs b/DysonNetwork.Pusher/Notification/PushService.cs index f62b0c9..e011e4e 100644 --- a/DysonNetwork.Pusher/Notification/PushService.cs +++ b/DysonNetwork.Pusher/Notification/PushService.cs @@ -3,7 +3,6 @@ using CorePush.Firebase; using DysonNetwork.Pusher.Connection; using DysonNetwork.Shared.Cache; using DysonNetwork.Shared.Proto; -using EFCore.BulkExtensions; using Microsoft.EntityFrameworkCore; using NodaTime; @@ -111,7 +110,7 @@ public class PushService return subscription; } - public void SendNotification(Account account, + public async Task SendNotification(Account account, string topic, string? title = null, string? subtitle = null, @@ -141,7 +140,7 @@ public class PushService if (save) _fbs.Enqueue(notification); - if (!isSilent) _ = DeliveryNotification(notification); + if (!isSilent) await DeliveryNotification(notification); } private async Task DeliveryNotification(Notification notification) @@ -337,4 +336,4 @@ public class PushService _logger.LogInformation( $"Successfully pushed notification #{notification.Id} to device {subscription.DeviceId} provider {subscription.Provider}"); } -} \ No newline at end of file +} diff --git a/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs b/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs index d93fe90..64fe847 100644 --- a/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs +++ b/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs @@ -85,7 +85,7 @@ public class PusherServiceGrpc( ServerCallContext context) { var account = await accountsHelper.GetAccount(Guid.Parse(request.UserId)); - pushService.SendNotification( + await pushService.SendNotification( account, request.Notification.Topic, request.Notification.Title, @@ -141,4 +141,4 @@ public class PusherServiceGrpc( return Task.FromResult(new GetWebsocketConnectionStatusResponse { IsConnected = isConnected }); } -} \ No newline at end of file +}