Skip to content

Commit

Permalink
Better handling for session expiry (deephaven#2986)
Browse files Browse the repository at this point in the history
Server should send a non-empty message when the session ends, and js
client should notify user of failure in all cases.

Partial deephaven#2985
  • Loading branch information
niloc132 authored Oct 11, 2022
1 parent 7d6b4ff commit e582a42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.github.f4b6a3.uuid.UuidCreator;
import com.google.protobuf.ByteString;
import com.google.rpc.Code;
import io.deephaven.auth.AuthenticationException;
import io.deephaven.auth.AuthenticationRequestHandler;
import io.deephaven.configuration.Configuration;
Expand Down Expand Up @@ -383,6 +384,9 @@ public TerminationNotificationListener(

@Override
void onClose() {
GrpcUtil.safelyExecuteLocked(responseObserver, () -> {
responseObserver.onError(GrpcUtil.statusRuntimeException(Code.UNAUTHENTICATED, "Session has ended"));
});
terminationListeners.remove(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,11 @@ private void subscribeToTerminationNotification() {
// restart the termination notification
subscribeToTerminationNotification();
return;
} else {
info.notifyConnectionError(Js.cast(fail));
}
}
assert success != null;

// welp; the server is gone -- let everyone know
info.notifyConnectionError(new ResponseStreamWrapper.Status() {
Expand Down

0 comments on commit e582a42

Please sign in to comment.