-
Notifications
You must be signed in to change notification settings - Fork 4k
Only store media data if in cached function #11635
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
✅ PR preview is ready!
|
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
| def save_media_data(media_data: bytes | str, mimetype: str, media_id: str) -> None: | ||
| CACHE_DATA_MESSAGE_REPLAY_CTX.save_media_data(media_data, mimetype, media_id) | ||
| CACHE_RESOURCE_MESSAGE_REPLAY_CTX.save_media_data(media_data, mimetype, media_id) |
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.
rename to save_media_data to better reflect that its not just about images.
sfc-gh-lwilby
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.
LGTM
Describe your changes
The current media file cache replay implementation is a bit inefficient. It can cause an unnecessary reference to media files to be kept for a longer time than needed. This PR ensures that we are only saving media for cache replay if it's actually within a cached function.
GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.