Skip to content

Commit

Permalink
fix(ws-fetcher): let websocket timeout fail silently
Browse files Browse the repository at this point in the history
  • Loading branch information
NuttyShrimp committed Apr 23, 2024
1 parent f4445df commit d342414
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/telraam/station/websocket/WebsocketClient.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package telraam.station.websocket;

import jakarta.websocket.*;
import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException;

import java.net.URI;

Expand All @@ -27,14 +28,21 @@ public void listen() throws RuntimeException {
try {
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
container.setDefaultMaxTextMessageBufferSize(100 * 1048576); // 100Mb
container.setDefaultMaxSessionIdleTimeout(0);
container.setAsyncSendTimeout(0);
container.setDefaultMaxSessionIdleTimeout(60);
container.connectToServer(this, endpoint);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

@OnError
public void onError(Session session, Throwable error) throws Throwable {
if (error instanceof WebSocketTimeoutException) {
return;
}
throw error;
}

@OnOpen
public void onOpen(Session session) {
this.session = session;
Expand Down

0 comments on commit d342414

Please sign in to comment.