`getMember` not writing to Member cache?
I have a task that is periodically doing some checks to update some content. This goes guild by guild (in the guilds that use the feature).
At some point I get the channel entity, and then I get the permissions for the bot. For this I use kordex's
GuildChannel.botHasPermissions
, and its first step is calling GuildBehaviour.getMember
with the bot's snowflake.
The problem is that this is doing a REST call every single time and therefore greatly slowing my process, not to mention the possibl rate limit implications.
I'm using EntitySupplyStrategy.cacheWithCachingRestFallback
. I have been browing through Kord's source and something I notice is:
On the handler for GuildMemberUpdate
, there's this:
Where memberData
is of type MemberData
.
On StoreEntitySupplier
, we have the following:
Where it.data
is of type UserData
.
Doesn't that mean that this entity is being saved to the User cache, and therefore not available when trying to get it from the Member cache?
I see that CacheEntitySupplier.getMemberOrNull
is using both caches in order to create the full Member object, so the cache is always returning null
.
Is this intended?6 Replies
Same case for
getGuildMembers
hm, that indeed seems like a bug
I'll try submitting a PR for this if I have time
thanks :)
PR created: https://github.com/kordlib/kord/pull/964
GitHub
Fix getMemberOrNull and getGuildMembers caching user data instead o...
As reported in Discord, these calls are storing the results to the user cache, so subsequent calls would not find them from cache.
When using cacheWithCachingRestFallback, this results in REST call...
nice :D