-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
avoid reading in whole blob during NamedBlobFile validation (slows TUS uploads) #155
Conversation
@djay thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
@davisagli any feedback on this solution? |
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.
@djay Sorry for the delay looking at this. I think you're on to something but have a suggestion to make sure we don't get rid of other parts of the validation.
@djay Could you add a changelog entry please? |
@jenkins-plone-org please run jobs |
@davisagli looks like restapi is using that schema to generate the json for the field. Failing test is (and same for image)
|
@djay We're getting into hack territory now but maybe you could do something like this:
But probably it would be cleaner to copy the code from Object._validate so you can pass in INamedTyped instead of self.schema |
@jenkins-plone-org please run jobs |
@davisagli I did this. didn't like copying all that code but seemed less hacky. It now passes everything. |
Redid the PR in #166 |
following on from plone/plone.restapi#1690
Currently NamedBlobFile and NamedImageFile fields read in the entire file contents during validation which can be slow and use a lot of memory for large files.
The validation itself doesn't do a lot. It's checking the data field has 0 or more length.
This fix bypasses this check and instead only checks the object provides the right schema.