⏪ Rollback skip push notify
This commit is contained in:
		| @@ -100,7 +100,7 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b | |||||||
|  |  | ||||||
| 	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | 	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | ||||||
| 	defer cancel() | 	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)), | 		UserId: lo.ToPtr(uint64(notification.AccountID)), | ||||||
| 		Body: nex.WebSocketPackage{ | 		Body: nex.WebSocketPackage{ | ||||||
| 			Action:  "notifications.new", | 			Action:  "notifications.new", | ||||||
| @@ -112,9 +112,6 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Skip push notification | 	// Skip push notification | ||||||
| 	if resp.GetIsAllSuccess() { |  | ||||||
| 		return nil |  | ||||||
| 	} |  | ||||||
| 	if GetStatusDisturbable(notification.AccountID) != nil { | 	if GetStatusDisturbable(notification.AccountID) != nil { | ||||||
| 		return 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...") | 	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{ | 	err = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{ | ||||||
| 		Providers:    providers, | 		Providers:    providers, | ||||||
| 		Tokens:       tokens, | 		Tokens:       tokens, | ||||||
| @@ -195,7 +190,7 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh | |||||||
| 	stream := proto.NewStreamServiceClient(gap.Nx.GetNexusGrpcConn()) | 	stream := proto.NewStreamServiceClient(gap.Nx.GetNexusGrpcConn()) | ||||||
| 	for _, notification := range notifications { | 	for _, notification := range notifications { | ||||||
| 		ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | 		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)), | 			UserId: lo.ToPtr(uint64(notification.AccountID)), | ||||||
| 			Body: nex.WebSocketPackage{ | 			Body: nex.WebSocketPackage{ | ||||||
| 				Action:  "notifications.new", | 				Action:  "notifications.new", | ||||||
| @@ -204,10 +199,6 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh | |||||||
| 		}) | 		}) | ||||||
| 		cancel() | 		cancel() | ||||||
|  |  | ||||||
| 		if err == nil && resp.GetIsAllSuccess() { |  | ||||||
| 			continue |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		// Skip push notification | 		// Skip push notification | ||||||
| 		if GetStatusDisturbable(notification.AccountID) != nil { | 		if GetStatusDisturbable(notification.AccountID) != nil { | ||||||
| 			continue | 			continue | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user