Remove stale client purging. Use sockets to count clients. #323
This commit is contained in:
@@ -43,32 +43,9 @@ func setupStats() error {
|
||||
}
|
||||
}()
|
||||
|
||||
staleViewerPurgeTimer := time.NewTicker(3 * time.Second)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-staleViewerPurgeTimer.C:
|
||||
purgeStaleViewers()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func purgeStaleViewers() {
|
||||
for clientID, client := range _stats.Clients {
|
||||
if client.LastSeen.IsZero() {
|
||||
continue
|
||||
}
|
||||
|
||||
timeSinceLastActive := time.Since(client.LastSeen).Minutes()
|
||||
if timeSinceLastActive > 1 {
|
||||
RemoveClient(clientID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//IsStreamConnected checks if the stream is connected or not
|
||||
func IsStreamConnected() bool {
|
||||
if !_stats.StreamConnected {
|
||||
|
||||
Reference in New Issue
Block a user