-
Notifications
You must be signed in to change notification settings - Fork 7
Updates cache with response #147
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
Updates cache with response #147
Conversation
…-api into update-cache-with-response # Conflicts: # api/src/main/java/com/javadiscord/jdi/core/api/DiscordResponseParser.java # core/src/main/java/com/javadiscord/jdi/core/Guild.java
closing pending further manual testing |
|
Message models are deserializing with a guildId of 0; the java model contains a guildId field, but the response bodies are arriving without the field. I don't know what the expected behavior is for Message response bodies, but this surprised me.
|
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.
Thanks for the great contribution! Just check out the comments and this should be good. I don't see any problems with the implementation.
api/src/main/java/com/javadiscord/jdi/core/api/utils/CacheUpdater.java
Outdated
Show resolved
Hide resolved
Just looking further at the code, perhaps the same should be done to the other methods?
This would mean iterating over the collections which might tred into some complicated terratory so I'm happy to leave that for a different PR. On another note: Damn those integration tests being so flakey! (it's discord's fault) |
If I am understanding correctly, you are asking to trace log the cache operation errors at the Map and List levels, which we definitely want. I did forget to add the caching call in I tried running the integration tests from my local and can confirm, Discord was being dumb and just sat there ¯_(ツ)_/¯ |
Looks good, can we actually comment out the map/list updates? So actually, we need to iterate over the collection and add the item 1-by-1 for example if we receive a I am happy to pick this up a little bit later down the line or you can attempt it yourself should you feel brave :D The implementation might look something like: for(T result : resultList) {
cacheUpdater.updateCache(result);
} Though the real implementation might differ. It should be similar with the Map, just looping over the values and ignoring the keys in that instance. |
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.
Please see comments, we're almost there!
I think there is a real miscommunication here, we are already adding the items to the cache one element at a time.... the iteration is happening in the cache updater, not the report parser...
|
|
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.
LGTM thanks for the contribution!
Will merge to main tomorrow morning.
@NightTripperID accident?? |
Updates cache with response
CacheUpdater
CacheUptater
intoDiscordResponseHandler
id
andguildId
fields, cache is not updated