Rollback skip push notify

This commit is contained in:
LittleSheep 2025-02-04 22:06:30 +08:00
parent 7ff93f1344
commit 4bf28e5298

View File

@ -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