mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-04 11:44:00 +00:00
Fix data race, add stat
This commit is contained in:
parent
405ad22372
commit
6b88b40538
2 changed files with 4 additions and 1 deletions
|
@ -160,6 +160,7 @@ func HTTPHandleRootURL(w http.ResponseWriter, r *http.Request) {
|
||||||
updateSysMem()
|
updateSysMem()
|
||||||
|
|
||||||
if Statistics.SysMemTotalKB-Statistics.SysMemFreeKB < Configuration.MinMemoryKBytes {
|
if Statistics.SysMemTotalKB-Statistics.SysMemFreeKB < Configuration.MinMemoryKBytes {
|
||||||
|
atomic.AddUint64(&Statistics.LowMemDroppedConnections, 1)
|
||||||
w.WriteHeader(503)
|
w.WriteHeader(503)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -439,7 +440,7 @@ func SendMessage(conn *websocket.Conn, msg ClientMessage) {
|
||||||
}
|
}
|
||||||
conn.SetWriteDeadline(getDeadline())
|
conn.SetWriteDeadline(getDeadline())
|
||||||
conn.WriteMessage(messageType, packet)
|
conn.WriteMessage(messageType, packet)
|
||||||
Statistics.MessagesSent++
|
atomic.AddUint64(&Statistics.MessagesSent, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalClientMessage unpacks websocket TextMessage into a ClientMessage provided in the `v` parameter.
|
// UnmarshalClientMessage unpacks websocket TextMessage into a ClientMessage provided in the `v` parameter.
|
||||||
|
|
|
@ -30,6 +30,8 @@ type StatsData struct {
|
||||||
MemoryInUseKB uint64
|
MemoryInUseKB uint64
|
||||||
MemoryRSSKB uint64
|
MemoryRSSKB uint64
|
||||||
|
|
||||||
|
LowMemDroppedConnections uint64
|
||||||
|
|
||||||
MemPerClientBytes uint64
|
MemPerClientBytes uint64
|
||||||
|
|
||||||
CpuUsagePct float64
|
CpuUsagePct float64
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue