mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-20 01:09:06 +08:00
fix: mutex lock to avoid concurrent map writes (#2796)
This commit is contained in:
parent
bc5862646d
commit
26a806a7fe
@ -308,9 +308,13 @@ func (a *Telemetry) SendEvent(event string, data map[string]interface{}, opts ..
|
|||||||
}
|
}
|
||||||
|
|
||||||
if rateLimitFlag {
|
if rateLimitFlag {
|
||||||
if a.rateLimits[event] < RATE_LIMIT_VALUE {
|
telemetry.mutex.Lock()
|
||||||
|
limit := a.rateLimits[event]
|
||||||
|
if limit < RATE_LIMIT_VALUE {
|
||||||
a.rateLimits[event] += 1
|
a.rateLimits[event] += 1
|
||||||
|
telemetry.mutex.Unlock()
|
||||||
} else {
|
} else {
|
||||||
|
telemetry.mutex.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user