[MM-52973] Avoid thundering herd problem in IsFirstUserAccount (#23549)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9a55280d7a
Коммит
b6b561a8f1
@@ -50,11 +50,13 @@ type PlatformService struct {
|
||||
sessionCache cache.Cache
|
||||
sessionPool sync.Pool
|
||||
|
||||
asymmetricSigningKey atomic.Pointer[ecdsa.PrivateKey]
|
||||
clientConfig atomic.Value
|
||||
clientConfigHash atomic.Value
|
||||
limitedClientConfig atomic.Value
|
||||
fetchUserCountForFirstUserAccountCheck atomic.Bool
|
||||
asymmetricSigningKey atomic.Pointer[ecdsa.PrivateKey]
|
||||
clientConfig atomic.Value
|
||||
clientConfigHash atomic.Value
|
||||
limitedClientConfig atomic.Value
|
||||
|
||||
isFirstUserAccountLock sync.Mutex
|
||||
isFirstUserAccount atomic.Bool
|
||||
|
||||
logger *mlog.Logger
|
||||
notificationsLogger *mlog.Logger
|
||||
@@ -129,7 +131,7 @@ func New(sc ServiceConfig, options ...Option) (*PlatformService, error) {
|
||||
}
|
||||
|
||||
// Assume the first user account has not been created yet. A call to the DB will later check if this is really the case.
|
||||
ps.fetchUserCountForFirstUserAccountCheck.Store(true)
|
||||
ps.isFirstUserAccount.Store(true)
|
||||
|
||||
// Step 1: Cache provider.
|
||||
// At the moment we only have this implementation
|
||||
|
||||
Ссылка в новой задаче
Block a user