-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
[#7977] Update AttachmentController#show_as_html
to do attachment masking in the background
#7979
Conversation
775b0a6
to
0d07b7a
Compare
AttachmentController#show_as_html
to do attachment masking in the background
42e1f8f
to
1113772
Compare
Add new `ensure_masked` callback to the `AttachmentController`. Currently just used by the `show` action but will be used for `show_as_html` soon.
This updates `AttachmentController#show_as_html` to do attachment masking in the background. Our "view attachments in the browser" feature, or "view as HTML", is doing a lot of processing inline in the web processes and this sometimes causes memory issues on the server and results in oom-kill running. Uses the same logic as the `#show` action to check an attachment is masked before proceeding with the action. This means it will time outs after 5 seconds and then redirect the `AttachmentMaskController` to wait for the job to complete before rendering a view saying the attachment is now viewable. Fixes #7977
1113772
to
7e6db46
Compare
Testing on staging and this works but I have changed the implementation slightly. Because we're not downloading files we don't need to render the |
This is up on staging for testing, I have added a In order to ensure attachments need to be masked, in the staging Rails console run: |
The reason for this PR is that we saw Apache had been stopped on the WDTK production server. This was due to Prior to this happening these processes were taking the most memory:
Looking at each:
|
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.
Reviewed on a call together. Looks great!
Relevant issue(s)
Fixes #7977
What does this do?
This updates
AttachmentController#show_as_html
to do attachment masking in the background.Why was this needed?
Our "view attachments in the browser" feature, or "view as HTML", is doing a lot of processing inline in the web processes and this sometimes causes memory issues on the server and results in oom-kill running.
Implementation notes
Uses the same logic as the
#show
action to check an attachment is masked before proceeding with the action. This means it will time outs after 5 seconds and then redirect theAttachmentMaskController
to wait for the job to complete before rendering a view saying the attachment is now viewable.