Skip to content
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

Request member from the gateway if missing from the cache #682

Merged
merged 3 commits into from
May 1, 2020
Merged

Request member from the gateway if missing from the cache #682

merged 3 commits into from
May 1, 2020

Conversation

Shadorc
Copy link
Contributor

@Shadorc Shadorc commented Apr 30, 2020

Description: In this commit 9c93af7, members are requested when not present in the cache using StoreEntityRetriever#getGuildMembers. This pull request does the same for getMemberById

Justification: #660

@quanticc quanticc added area/core Related to core module: events, entities, clients, specs enhancement Improvement over an existing feature labels Apr 30, 2020
@quanticc quanticc added this to the 3.1.0.M3 milestone Apr 30, 2020
Copy link
Member

@quanticc quanticc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about requesting all members on this call, as opposed to just one?

@Discord4J/members

@Alex1304
Copy link
Contributor

hm I don't really like this. Requesting the whole member list just to get 1 member is not correct to me. This approach wouldn't even work if you don't have GUILD_MEMBERS intent.
The problem resides in the fact that you can't send a request members payload asking for just 1 member by ID.

When you want to request only 1 member by their ID, a REST request seems appropriate. But then it won't be cached, and that's another problem if you fetch same member multiple times.

It looks like it's impossible to find a solution satisfying all cases with the current API...

@Shadorc
Copy link
Contributor Author

Shadorc commented Apr 30, 2020

In fact, we can request one (or more) user by their IDs. It seems that people prefer one request instead of the whole guild, I have updated my PR to reflect this.
For my use case, I will just create a custome StoreEntityRetriever doing what I was thinking first.

@quanticc quanticc merged commit 55934e3 into Discord4J:master May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Related to core module: events, entities, clients, specs enhancement Improvement over an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants