mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-15 20:08:18 +08:00
fix(team): fresh event-stream subscriptions deliver live events only, no stale replay
This commit is contained in:
parent
b6326daaf8
commit
7fb23e5404
@ -255,7 +255,11 @@ public class TeamController {
|
|||||||
public SseEmitter events(@PathVariable Long id,
|
public SseEmitter events(@PathVariable Long id,
|
||||||
@RequestHeader(value = "Last-Event-ID", required = false) Long lastEventId) {
|
@RequestHeader(value = "Last-Event-ID", required = false) Long lastEventId) {
|
||||||
SseEmitter emitter = new SseEmitter(0L);
|
SseEmitter emitter = new SseEmitter(0L);
|
||||||
eventChannel.attach(id, emitter, lastEventId == null ? 0L : lastEventId);
|
// A fresh subscription is an activity ticker, not a transcript: skip
|
||||||
|
// the ring-buffer replay (stale events would render as breaking news)
|
||||||
|
// and deliver live events only. A reconnect carrying Last-Event-ID
|
||||||
|
// keeps the resume-from-where-I-left semantics.
|
||||||
|
eventChannel.attach(id, emitter, lastEventId == null ? Long.MAX_VALUE : lastEventId);
|
||||||
return emitter;
|
return emitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user