From 4bf28e529823c064fbb3567de73144edea801669 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 4 Feb 2025 22:06:30 +0800 Subject: [PATCH] :rewind: Rollback skip push notify --- pkg/internal/services/notifications.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pkg/internal/services/notifications.go b/pkg/internal/services/notifications.go index 16d0b85..e3530d3 100644 --- a/pkg/internal/services/notifications.go +++ b/pkg/internal/services/notifications.go @@ -100,7 +100,7 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - resp, err := proto.NewStreamServiceClient(gap.Nx.GetNexusGrpcConn()).PushStream(ctx, &proto.PushStreamRequest{ + _, err := proto.NewStreamServiceClient(gap.Nx.GetNexusGrpcConn()).PushStream(ctx, &proto.PushStreamRequest{ UserId: lo.ToPtr(uint64(notification.AccountID)), Body: nex.WebSocketPackage{ Action: "notifications.new", @@ -112,9 +112,6 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b } // Skip push notification - if resp.GetIsAllSuccess() { - return nil - } if GetStatusDisturbable(notification.AccountID) != nil { return nil } @@ -135,8 +132,6 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b log.Debug().Str("topic", notification.Topic).Any("uid", notification.AccountID).Msg("Pushing notify to user...") - ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second) - defer cancel() err = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{ Providers: providers, Tokens: tokens, @@ -195,7 +190,7 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh stream := proto.NewStreamServiceClient(gap.Nx.GetNexusGrpcConn()) for _, notification := range notifications { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - resp, err := stream.PushStream(ctx, &proto.PushStreamRequest{ + _, _ = stream.PushStream(ctx, &proto.PushStreamRequest{ UserId: lo.ToPtr(uint64(notification.AccountID)), Body: nex.WebSocketPackage{ Action: "notifications.new", @@ -204,10 +199,6 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh }) cancel() - if err == nil && resp.GetIsAllSuccess() { - continue - } - // Skip push notification if GetStatusDisturbable(notification.AccountID) != nil { continue