-
Notifications
You must be signed in to change notification settings - Fork 213
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
Add ADRF and make the thumbnail view async #3020
Conversation
e8a415c
to
2d9485f
Compare
14d064c
to
f956f4e
Compare
f956f4e
to
17802db
Compare
66c95b6
to
dc44ee8
Compare
dc44ee8
to
f9c66bf
Compare
django-split-settings = "*" | ||
psycopg = "~=3.1" |
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.
Just moving things into alphabetical order here. The only meaningful change is to add adrf at the top.
is_full_size: bool = False, | ||
is_compressed: bool = True, | ||
media_info: ImageProxyMediaInfo, | ||
proxy_config: ImageProxyConfig = ImageProxyConfig(), |
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.
This might be a bad name, maybe "image proxy request config"?
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.
Yea I think request_proxy_config
for the variable itself might be better 🤔
This does not convert the `image_proxy.get` to async to avoid making this initial PR more complicated than it needs to be, and to avoid being blocked on the aiohttp client session sharing which we will want to have in before we convert the image proxy to use aiohttp.
6d61fd4
to
8897c78
Compare
Based on the high urgency of this PR, the following reviewers are being gently reminded to review this PR: @krysal Excluding weekend1 days, this PR was ready for review 2 day(s) ago. PRs labelled with high urgency are expected to be reviewed within 2 weekday(s)2. @sarayourfriend, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings. Footnotes
|
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! All endpoints seem to be working normally. I did notice a lack of static files in my local server, but it could just be my setup so approving.
@sarayourfriend were you able to receive static files? I did a complete rebuild of my images and the static files were not being served.
I also had this and also assumed it was my local. Clearly a bad assumption from me, apologies. I'll have a fix up soon. |
@dhruvkb Can you run |
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.
This looks good! I'm able to build and run it locally, and it appropriately serves the static files for me on localhost:50270 🚀
is_full_size: bool = False, | ||
is_compressed: bool = True, | ||
media_info: ImageProxyMediaInfo, | ||
proxy_config: ImageProxyConfig = ImageProxyConfig(), |
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.
Yea I think request_proxy_config
for the variable itself might be better 🤔
thumbnail_action = action( | ||
detail=True, | ||
url_path="thumb", | ||
url_name="thumb", | ||
serializer_class=media_serializers.MediaThumbnailRequestSerializer, | ||
throttle_classes=[AnonThumbnailRateThrottle, OAuth2IdThumbnailRateThrottle], | ||
) |
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.
Nice!
@AetherUnbound I updated the dataclass names to simplify them and make the request config role clearer. |
Fixes
First step of #2789 by @sarayourfriend
Description
This is the first step to convert the image proxy route to async. It converts the overall view to async. I've split this into a separate PR because (a) it is complex enough on its own and (b) converting the actual
image_proxy.get
function is blocked on sharing the aiohttp client session (for which I'll have another PR up later today, it's already finished I just forgot to push it last night 🤦).So this PR only converts the view side of things to async. It does this by abstracting the thumbnails route in a slightly different way than it was before, which allows the audio and image views to ignore most of the safe-sync-in-async compatibility issues. To make that interplay a little easier, I decided to refactor
image_proxy.get
to use two MRO objects for the input, rather than the one-by-one parameter definitions. Now that I'm writing this, I'm realising that I could have avoided the changes toimage_proxy.get
itself by creating a new response definition forget_image_proxy_media_info
and then usingasdict
to spread that intoimage_proxy.get
. If y'all want me to make that change, I think it's a fine one to simplify the overall PR. On the other hand, I think the new API is also a bit cleaner, if potentially too abstract. Let me know what y'all think because I'm two minds about it.Testing Instructions
Checkout the PR and run
just build web
to get the new dependencies. Also keep in mind that this PR depends on #3011.Run
just api/up
and make various search requests, thumbnail, and related requests. Generally: exercise the image and audio media views and their various routes. Everything should essentially work as it did before. The existing API integration tests should also continue to work, along will all unit tests. This change should be generally totally transparent and not result in any observable differences on the consumer side, which is why I didn't add any new tests for this: the existing tests already cover the media view and should continue to work without changes. The only tests I changed were to use pook a little more fluidly and to accommodate the changes to theimage_proxy.get
function's interface.Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin