refactor: simplify oninterval routine; fix(runtime): session end handler; update realtime chart example

This commit is contained in:
Joao Goncalves
2025-12-04 12:40:36 -01:00
parent 51218e7a2a
commit 26268f698a
4 changed files with 82 additions and 90 deletions

9
via.go
View File

@@ -392,7 +392,11 @@ func New() *V {
v.logDebug(c, "SSE connection established")
go func() {
c.Sync()
if v.cfg.DevMode {
c.Sync()
return
}
c.SyncSignals()
}()
for {
@@ -461,17 +465,16 @@ func New() *V {
defer r.Body.Close()
cID := string(body)
c, err := v.getCtx(cID)
c.stopAllRoutines()
if err != nil {
v.logErr(c, "failed to handle session close: %v", err)
return
}
c.stopAllRoutines()
v.logDebug(c, "session close event triggered")
if v.cfg.DevMode {
v.devModeRemovePersisted(c)
}
v.unregisterCtx(c)
})
return v
}