Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 088b32c

Browse files
committed
fix: Memory leak when using reactive subscriptions with KeepAlive
1 parent 897c477 commit 088b32c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

graphql-kickstart-spring-webflux/src/main/java/graphql/kickstart/spring/webflux/ReactiveWebSocketSubscriptionSession.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
public class ReactiveWebSocketSubscriptionSession extends DefaultSubscriptionSession {
99

1010
private final WebSocketSession webSocketSession;
11+
private boolean opened = true;
1112

1213
public ReactiveWebSocketSubscriptionSession(
1314
GraphQLSubscriptionMapper mapper, WebSocketSession webSocketSession) {
@@ -17,7 +18,7 @@ public ReactiveWebSocketSubscriptionSession(
1718

1819
@Override
1920
public boolean isOpen() {
20-
return true;
21+
return opened;
2122
}
2223

2324
@Override
@@ -34,4 +35,10 @@ public String getId() {
3435
public WebSocketSession unwrap() {
3536
return webSocketSession;
3637
}
38+
39+
@Override
40+
public void close(final String reason) {
41+
super.close(reason);
42+
this.opened = false;
43+
}
3744
}

0 commit comments

Comments
 (0)