only send push notification if call stream not cancelled

This commit is contained in:
woodser 2022-12-28 08:01:39 +00:00
parent c5f6aeb4cc
commit 9f8bd77c9e

View File

@ -10,6 +10,7 @@ import bisq.proto.grpc.SendNotificationReply;
import bisq.proto.grpc.SendNotificationRequest; import bisq.proto.grpc.SendNotificationRequest;
import io.grpc.Context; import io.grpc.Context;
import io.grpc.ServerInterceptor; import io.grpc.ServerInterceptor;
import io.grpc.stub.ServerCallStreamObserver;
import io.grpc.stub.StreamObserver; import io.grpc.stub.StreamObserver;
import javax.inject.Inject; import javax.inject.Inject;
@ -80,9 +81,11 @@ class GrpcNotificationsService extends NotificationsImplBase {
@Override @Override
public void onMessage(@NonNull NotificationMessage message) { public void onMessage(@NonNull NotificationMessage message) {
if (!((ServerCallStreamObserver<NotificationMessage>) responseObserver).isCancelled()) {
responseObserver.onNext(message); responseObserver.onNext(message);
} }
} }
}
final ServerInterceptor[] interceptors() { final ServerInterceptor[] interceptors() {
Optional<ServerInterceptor> rateMeteringInterceptor = rateMeteringInterceptor(); Optional<ServerInterceptor> rateMeteringInterceptor = rateMeteringInterceptor();