![]() To that end we transmit a Last-Modified header field carrying the UTC If the image in the client cache is up-to-date. However, Workhorse implements standard conditional HTTP request strategies that allow us to skip the scaler We currently do not store rescaled images anywhere the scaler runs every time a smaller version is requested. Scaling work, and stream the result back to the client. To actually scale the image, Workhorse will finally fork into a child process that performs the actual If the file meets the configured maximum allowed size constraint (to keep memory consumption in check). We can actually rescale the image, such as making sure we wouldn’t outgrow our scaler process budget but also Workhorse will handle the location transparently so Rails does not need to be concerned with where the imageĪdditionally, to request validation in Rails, Workhorse will run several pre-condition checks to ensure that (a path if the image resides in block storage, or a URL to remote storage otherwise) and the desired width. The only inputs it requires are the location of the image Will be invoked that knows how to rescale images. ![]() Instruction through the Rails response, a special response injector WorkhorseĪssuming Rails decided the request to be valid, Workhorse will take over. We follow the path we take to serve any ordinary upload. If Rails decides the request does not constitute a valid image scaling request, Header field ( Gitlab-Workhorse-Send-Data) with the necessary parameters for Workhorse to carry It should trigger the image scaler as per the criteria mentioned above, and if so, render a special response Upon receiving a request coming from a client through Workhorse, we check whether Therefore, all image scaling related logic in Rails is currently found in theĬontroller mixin. Workhorse->+Workhorse: invoke image scalerĬurrently, image scaling is limited to Upload entities, specifically avatars as mentioned above. Rails->-Workhorse: Gitlab-Workhorse-Send-Data: send-scaled-image Happens in Rails, whereas the “heavy lifting”, scaling and serving the binary data, happens in Workhorse.Ĭlient->+Workhorse: GET /uploads/-/system/project/avatar/278964/logo-extra-whitespace.png?width=64 Pattern in GitLab: important business logic such as request authentication and validation This is a common implementation and performance Rails and Workhorse currently collaborate to rescale images. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |