API: Add GetAllOnlineUsers RPC to StatsService for retrieving online users (#5080)

This commit is contained in:
Maxim Plotnikov authored and GitHub committed 2025-12-26 16:07:06 -05:00
1 parent 6738ecf68e
commit ad468e462d
8 files changed
+366 -220

No files matched your search

+15
View File
@@ -161,6 +161,21 @@ func (m *Manager) GetChannel(name string) stats.Channel {
return nil
}
// GetAllOnlineUsers implements stats.Manager.
func (m *Manager) GetAllOnlineUsers() []string {
m.access.Lock()
defer m.access.Unlock()
usersOnline := make([]string, 0, len(m.onlineMap))
for user, onlineMap := range m.onlineMap {
if len(onlineMap.IpTimeMap()) > 0 {
usersOnline = append(usersOnline, user)
}
}
return usersOnline
}
// Start implements common.Runnable.
func (m *Manager) Start() error {
m.access.Lock()