Fix broker race condition

This commit is contained in:
itchyonion 2022-05-26 23:26:38 -07:00
parent c983c13a84
commit 03b2b56f87
2 changed files with 23 additions and 20 deletions

View file

@ -154,8 +154,8 @@ func (ctx *BrokerContext) AddSnowflake(id string, proxyType string, natType stri
heap.Push(ctx.restrictedSnowflakes, snowflake)
}
ctx.metrics.promMetrics.AvailableProxies.With(prometheus.Labels{"nat": natType, "type": proxyType}).Inc()
ctx.snowflakeLock.Unlock()
ctx.idToSnowflake[id] = snowflake
ctx.snowflakeLock.Unlock()
return snowflake
}