mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-19 14:48:09 -07:00
Thread safe, but unsafe
This commit is contained in:
+10
-1
@@ -106,6 +106,10 @@ func (s *Stats) RecordEvent(event int) {
|
||||
s.events <- event
|
||||
}
|
||||
|
||||
func (s *Stats) RecordTiming(event int, duration time.Duration) {
|
||||
// s.timingEvents <- event
|
||||
}
|
||||
|
||||
func (s *Stats) handleEvents() {
|
||||
for event := range s.events {
|
||||
switch event {
|
||||
@@ -178,7 +182,12 @@ func (s *Stats) handleEvents() {
|
||||
}
|
||||
}
|
||||
|
||||
// RecordEvent broadcasts an event to the default stats tracking.
|
||||
// RecordEvent broadcasts an event to the default stats queue.
|
||||
func RecordEvent(event int) {
|
||||
DefaultStats.RecordEvent(event)
|
||||
}
|
||||
|
||||
// RecordTiming broadcasts a timing event to the default stats queue.
|
||||
func RecordTiming(event int, duration time.Duration) {
|
||||
DefaultStats.RecordTiming(event, duration)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user