dbus: fix streaming performance
- sendNotification now async (fire-and-forget goroutine) - ChatUpdated coalescing interval 50ms -> 150ms to reduce signal flood
This commit is contained in:
parent
8bd59a6509
commit
d907aa53f4
4
main.go
4
main.go
|
|
@ -73,7 +73,7 @@ func (e *chatEmitter) append(text string) {
|
|||
e.buf += text
|
||||
if !e.running {
|
||||
e.running = true
|
||||
e.timer = time.AfterFunc(50*time.Millisecond, e.flush)
|
||||
e.timer = time.AfterFunc(150*time.Millisecond, e.flush)
|
||||
}
|
||||
e.mu.Unlock()
|
||||
}
|
||||
|
|
@ -707,6 +707,7 @@ func (m *SessionManager) DismissDetached(sessionID string, pid int32) (bool, *db
|
|||
// --- Notifications ---
|
||||
|
||||
func (m *SessionManager) sendNotification(title, body string) {
|
||||
go func() {
|
||||
obj := m.conn.Object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
||||
obj.Call("org.freedesktop.Notifications.Notify", 0,
|
||||
"ollie-dbus", // app_name
|
||||
|
|
@ -718,6 +719,7 @@ func (m *SessionManager) sendNotification(title, body string) {
|
|||
map[string]dbus.Variant{}, // hints
|
||||
int32(5000), // timeout ms
|
||||
)
|
||||
}()
|
||||
}
|
||||
|
||||
// --- Session Persistence ---
|
||||
|
|
|
|||
Reference in New Issue