1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-03 20:00:57 +00:00

Separate CurrentClientCount and global subs

This commit is contained in:
Kane York 2017-09-15 13:07:41 -07:00
parent 42c82251be
commit 26ac45358e
2 changed files with 6 additions and 2 deletions

View file

@ -27,6 +27,7 @@ type StatsData struct {
} }
CurrentClientCount uint64 CurrentClientCount uint64
LiveClientCount uint64
PubSubChannelCount int PubSubChannelCount int
@ -81,7 +82,7 @@ func commandCounter() {
} }
// StatsDataVersion is the version of the StatsData struct. // StatsDataVersion is the version of the StatsData struct.
const StatsDataVersion = 6 const StatsDataVersion = 7
const pageSize = 4096 const pageSize = 4096
var cpuUsage struct { var cpuUsage struct {
@ -152,7 +153,7 @@ func updatePeriodicStats() {
GlobalSubscriptionLock.RLock() GlobalSubscriptionLock.RLock()
Statistics.CurrentClientCount = uint64(len(GlobalSubscriptionInfo)) Statistics.LiveClientCount = uint64(len(GlobalSubscriptionInfo))
versions := make(map[string]uint64) versions := make(map[string]uint64)
for _, v := range GlobalSubscriptionInfo { for _, v := range GlobalSubscriptionInfo {
versions[v.VersionString]++ versions[v.VersionString]++

View file

@ -89,6 +89,9 @@ type ClientInfo struct {
Version ClientVersion Version ClientVersion
// Set after a successful hello message.
HelloOK bool
// This mutex protects writable data in this struct. // This mutex protects writable data in this struct.
// If it seems to be a performance problem, we can split this. // If it seems to be a performance problem, we can split this.
Mutex sync.Mutex Mutex sync.Mutex