-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
ref(hc): Introduce RpcUserProfile and UserService.get_many_profiles #68847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Offer a more performant alternative to UserService.get_many that provides all attributes that can be provided without fetching from any related tables.
Rename `ids_only` to more accurately reflect what it does, since `get_many_profiles` is now using it to fetch more than just IDs but still wants to avoid selecting any related data. Make `query_many` no longer private by convention. We now want to call it directly, so that we can then do a different kind of serialization than _UserFilterQuery's default. (DatabaseBackedUserSocialAuthService also was previously calling it directly.)
@@ -34,12 +34,13 @@ class RpcAuthenticator(RpcModel): | |||
config: Any = None | |||
|
|||
|
|||
class RpcUser(RpcModel): | |||
class RpcUserProfile(RpcModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know introducing this new noun ("profile") could be a little confusing. I hope it fits.
I considered naming it something like RpcMinimalUser
, but that would mess up the semantics of the "is-a" relationship. That is, RpcUser
extending RpcMinimalUser
implies "an RpcUser
is an RpcMinimalUser
", which is wrong because RpcUser
is not minimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Profile seems like a decent name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think profile is better than minimal. We have also used Summary
for similar result types like OrganizationSummary
.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #68847 +/- ##
===========================================
+ Coverage 58.20% 79.72% +21.51%
===========================================
Files 6420 6423 +3
Lines 284863 284799 -64
Branches 49079 49039 -40
===========================================
+ Hits 165817 227060 +61243
+ Misses 118650 57373 -61277
+ Partials 396 366 -30
|
@@ -34,12 +34,13 @@ class RpcAuthenticator(RpcModel): | |||
config: Any = None | |||
|
|||
|
|||
class RpcUser(RpcModel): | |||
class RpcUserProfile(RpcModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think profile is better than minimal. We have also used Summary
for similar result types like OrganizationSummary
.
https://github.com/getsentry/getsentry/pull/13660 should fix the |
Offer a more performant alternative to UserService.get_many that provides all attributes that can be provided without fetching from any related tables.
Rename
ids_only
to more accurately reflect what it does, sinceget_many_profiles
is now using it to fetch more than just IDs but still wants to avoid selecting any related data.Make
query_many
no longer private by convention. We now want to call it directly, so that we can then do a different kind of serialization than _UserFilterQuery's default. (DatabaseBackedUserSocialAuthService also was previously calling it directly.)