🐛 Bug fixes pushing notification skip stragry
This commit is contained in:
parent
a40ab9efdb
commit
7ff93f1344
@ -3,12 +3,13 @@ package services
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||
"git.solsynth.dev/hypernet/pusher/pkg/pushkit"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/samber/lo"
|
||||
@ -194,7 +195,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)
|
||||
_, _ = stream.PushStream(ctx, &proto.PushStreamRequest{
|
||||
resp, err := stream.PushStream(ctx, &proto.PushStreamRequest{
|
||||
UserId: lo.ToPtr(uint64(notification.AccountID)),
|
||||
Body: nex.WebSocketPackage{
|
||||
Action: "notifications.new",
|
||||
@ -203,6 +204,10 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh
|
||||
})
|
||||
cancel()
|
||||
|
||||
if err == nil && resp.GetIsAllSuccess() {
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip push notification
|
||||
if GetStatusDisturbable(notification.AccountID) != nil {
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user