Skip to content

Commit 50eb785

Browse files
committed
release 9.1.6
Signed-off-by: neo <1100909+neowu@users.noreply.github.com>
1 parent 113eb15 commit 50eb785

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
## Change log
22

3-
### 9.1.6-b0 (2/10/2025 - )
3+
### 9.1.6 (2/10/2025 - 2/25/2025)
44

55
* http_client: tweak sse checking
66
* undertow: updated to 2.3.18.Final
77
> due to vulnerability of old versions, has to update to latest despite potential memory consumption is higher
88
* sse: support method PUT/POST with body
99
* sse: channel.close() now closes sse connection gracefully
1010
* sse: change retry instruction to 5s
11-
> in cloud env, we set backend timeout to around 620s, and let client (js) reconnect every 600s
11+
> in cloud env, backend timeout is set to 600s
12+
* sse: channel.send() returns if sent successfully
1213

1314
### 9.1.5 (11/11/2024 - 01/22/2025)
1415

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apply(plugin = "project")
77

88
subprojects {
99
group = "core.framework"
10-
version = "9.1.6-b1"
10+
version = "9.1.6"
1111
}
1212

1313
val elasticVersion = "8.15.0"

core-ng/src/main/java/core/framework/internal/web/sse/ChannelImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,20 @@ class ChannelImpl<T> implements java.nio.channels.Channel, Channel<T> {
5151
}
5252

5353
@Override
54-
public void send(String id, T event) {
54+
public boolean send(String id, T event) {
5555
String data = builder.build(id, event);
56-
send(data);
56+
return send(data);
5757
}
5858

59-
void send(String data) {
60-
if (closed) return;
59+
boolean send(String data) {
60+
if (closed) return false;
6161

6262
var watch = new StopWatch();
6363
try {
6464
queue.add(Strings.bytes(data));
6565
lastSentTime = System.nanoTime();
6666
sink.getIoThread().execute(() -> writeListener.handleEvent(sink));
67+
return true;
6768
} finally {
6869
long elapsed = watch.elapsed();
6970
ActionLogContext.track("sse", elapsed, 0, data.length());

core-ng/src/main/java/core/framework/internal/web/sse/ServerSentEventHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
import java.util.Map;
2929

3030
public class ServerSentEventHandler implements HttpHandler {
31-
static final long MAX_PROCESS_TIME_IN_NANO = Duration.ofSeconds(300).toNanos(); // persistent connection, use longer max process time, and background task keeps pinging the connection
31+
// persistent connection, use longer max process time
32+
// though LB backend timeout is to 600s, for long time sse, it should be processed via message queue
33+
static final long MAX_PROCESS_TIME_IN_NANO = Duration.ofSeconds(300).toNanos();
3234

3335
private static final HttpString LAST_EVENT_ID = new HttpString("Last-Event-ID");
3436
private final Logger logger = LoggerFactory.getLogger(ServerSentEventHandler.class);

core-ng/src/main/java/core/framework/web/sse/Channel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package core.framework.web.sse;
22

33
public interface Channel<T> {
4-
void send(String id, T event);
4+
// return true if event is queued, return false if channel is closed
5+
boolean send(String id, T event);
56

67
default void send(T event) {
78
send(null, event);

core-ng/src/test/java/core/framework/internal/web/sse/ServerSentEventContextImplTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.List;
99

1010
import static org.assertj.core.api.Assertions.assertThat;
11-
import static org.mockito.Mockito.doNothing;
11+
import static org.mockito.Mockito.doReturn;
1212
import static org.mockito.Mockito.spy;
1313
import static org.mockito.Mockito.verify;
1414

@@ -71,7 +71,7 @@ void keepAlive() {
7171
context.keepAlive();
7272

7373
channel.lastSentTime = 0;
74-
doNothing().when(channel).send(":\n");
74+
doReturn(Boolean.TRUE).when(channel).send(":\n");
7575
context.keepAlive();
7676
verify(channel, Mockito.times(1)).send(":\n");
7777
}

0 commit comments

Comments
 (0)