-
Notifications
You must be signed in to change notification settings - Fork 21
[Forget] Fetch less data #276
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
[Forget] Fetch less data #276
Conversation
feba6c0 to
3f5c5a0
Compare
hoh
left a comment
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 am not a big fan of redefining multiple Message types recent PRs, but that can always be improved later and this PR improves over the current situation.
A few minor comments but nothing blocking or consequent.
| or target_info.content_item_hash is None | ||
| ): | ||
| raise ValueError( | ||
| f"Could not garbage collect content linked to STORE message {target_hash}." |
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.
Can you make this message more explicit ? Something like:
| f"Could not garbage collect content linked to STORE message {target_hash}." | |
| f"Information missing, could not garbage collect content linked to STORE message {target_hash}." |
| or target_info.content_item_hash is None | ||
| ): | ||
| raise ValueError( | ||
| f"Could not garbage collect content linked to STORE message {target_hash}." |
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.
Why put the target_hash in the string and not as another argument ?
| f"Could not garbage collect content linked to STORE message {target_hash}." | |
| f"Could not garbage collect content linked to STORE message", target_hash |
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 actually never passed several values to ValueError, I see that it works (it makes the args property a tuple), is there an upside in doing this besides avoiding the string formatting?
Reduced the data usage of the forget handler in two ways. 1. Stop relying on `get_message_content` to retrieve the content of a message. As the message is guaranteed to already be on the node, we can directly get the parts of interest from the DB. 2. Only retrieve the fields relevant to the handling of the forget message from the DB. Rather than retrieving the whole content, which can be quite large, we now only retrieve the address, item type and item hash from the DB. This should improve the performance of the handler. Introduced a new class, `TargetMessageInfo`, to represent the data we fetch from the DB.
59f44b1 to
ccf56f0
Compare
Reduced the data usage of the forget handler in two ways.
Stop relying on
get_message_contentto retrieve the contentof a message. As the message is guaranteed to already be on
the node, we can directly get the parts of interest from the DB.
Only retrieve the fields relevant to the handling of the forget
message from the DB. Rather than retrieving the whole content,
which can be quite large, we now only retrieve the address, item
type and item hash from the DB. This should improve the performance
of the handler. Introduced a new class,
TargetMessageInfo, torepresent the data we fetch from the DB.