Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Jun 13, 2025

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

  • Added unit test.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 13, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-11635/streamlit-1.45.1-py3-none-any.whl
🕹️ Preview app pr-11635.streamlit.app (☁️ Deploy here if not accessible)

@snyk-io
Copy link
Contributor

snyk-io bot commented Jun 13, 2025

🎉 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)

@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Jun 13, 2025
@lukasmasuch lukasmasuch marked this pull request as ready for review June 13, 2025 16:42
Comment on lines +75 to +77
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)
Copy link
Collaborator Author

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.

@lukasmasuch lukasmasuch changed the title [WIP] Only store media data if in cached function Only store media data if in cached function Jun 13, 2025
Copy link
Collaborator

@sfc-gh-lwilby sfc-gh-lwilby left a comment

Choose a reason for hiding this comment

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

LGTM

@lukasmasuch lukasmasuch merged commit 3bf7585 into develop Jun 14, 2025
36 checks passed
@lukasmasuch lukasmasuch deleted the improve-cache-replay-data-handling branch June 14, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants