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
26
main.go
26
main.go
|
|
@ -73,7 +73,7 @@ func (e *chatEmitter) append(text string) {
|
||||||
e.buf += text
|
e.buf += text
|
||||||
if !e.running {
|
if !e.running {
|
||||||
e.running = true
|
e.running = true
|
||||||
e.timer = time.AfterFunc(50*time.Millisecond, e.flush)
|
e.timer = time.AfterFunc(150*time.Millisecond, e.flush)
|
||||||
}
|
}
|
||||||
e.mu.Unlock()
|
e.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
@ -707,17 +707,19 @@ func (m *SessionManager) DismissDetached(sessionID string, pid int32) (bool, *db
|
||||||
// --- Notifications ---
|
// --- Notifications ---
|
||||||
|
|
||||||
func (m *SessionManager) sendNotification(title, body string) {
|
func (m *SessionManager) sendNotification(title, body string) {
|
||||||
obj := m.conn.Object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
go func() {
|
||||||
obj.Call("org.freedesktop.Notifications.Notify", 0,
|
obj := m.conn.Object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
||||||
"ollie-dbus", // app_name
|
obj.Call("org.freedesktop.Notifications.Notify", 0,
|
||||||
uint32(0), // replaces_id
|
"ollie-dbus", // app_name
|
||||||
"system-run", // app_icon
|
uint32(0), // replaces_id
|
||||||
title, // summary
|
"system-run", // app_icon
|
||||||
body, // body
|
title, // summary
|
||||||
[]string{}, // actions
|
body, // body
|
||||||
map[string]dbus.Variant{}, // hints
|
[]string{}, // actions
|
||||||
int32(5000), // timeout ms
|
map[string]dbus.Variant{}, // hints
|
||||||
)
|
int32(5000), // timeout ms
|
||||||
|
)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Session Persistence ---
|
// --- Session Persistence ---
|
||||||
|
|
|
||||||
Reference in New Issue