GraphQL: Unlock goroutine throttle to match batch capacity (#20146)
We were throttling the amount of concurrent resolvers at a given time. The idea behind this was to avoid overloading the database with too many requests. However, with the introduction of dataloaders, this limitation actually becomes a bottleneck because all DB calls are actually batched, so we are unnecessarily throttling the amount of items that can be processed in a single batch. The only caveat with this is that now all resolvers need to backed by dataloaders, or otherwise not be queried as part of a loop. In a subsequent PR, we will be removing channel stats from under channel to be a top-level object to be returned for a given channel. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a3af488492
Коммит
fed5404166
@@ -93,6 +93,10 @@ func (us *UserService) GetUser(userID string) (*model.User, error) {
|
||||
return us.store.Get(context.Background(), userID)
|
||||
}
|
||||
|
||||
func (us *UserService) GetUsers(userIDs []string) ([]*model.User, error) {
|
||||
return us.store.GetMany(context.Background(), userIDs)
|
||||
}
|
||||
|
||||
func (us *UserService) GetUserByUsername(username string) (*model.User, error) {
|
||||
return us.store.GetByUsername(username)
|
||||
}
|
||||
@@ -105,7 +109,7 @@ func (us *UserService) GetUserByAuth(authData *string, authService string) (*mod
|
||||
return us.store.GetByAuth(authData, authService)
|
||||
}
|
||||
|
||||
func (us *UserService) GetUsers(options *model.UserGetOptions) ([]*model.User, error) {
|
||||
func (us *UserService) GetUsersFromProfiles(options *model.UserGetOptions) ([]*model.User, error) {
|
||||
return us.store.GetAllProfiles(options)
|
||||
}
|
||||
|
||||
@@ -114,7 +118,7 @@ func (us *UserService) GetUsersByUsernames(usernames []string, options *model.Us
|
||||
}
|
||||
|
||||
func (us *UserService) GetUsersPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, error) {
|
||||
users, err := us.GetUsers(options)
|
||||
users, err := us.GetUsersFromProfiles(options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user