FEATURE: Add global and worker timeout option.#184
FEATURE: Add global and worker timeout option.#184oblakeerickson wants to merge 1 commit intotoy:masterfrom
Conversation
|
Thanks a lot for reopening the PR and sorry for the wait. I'm still procrastinating what would be the good interface for handling timeouts when optimising single image ( Currently my train of thoughts lead to following: What are your thoughts on this? |
Yes, I agree with this. I just played around with my PR and this currently isn't the case, so I'll work on a fix for it.
This should be fine. Discourse doesn't use
Oh okay, yes, I think if there is a global timeout and we have already achieved a result we should return the result instead of an exception. The exception should only be for when we have zero results and have reached the global timeout. Looks like there are a couple of changes to make to this pr then. I'll start working on those change to match these ideas and also clean up any rubocop issues now that it has been updated. |
|
Okay, I pushed a couple more commits addressing your feedback: When optimizing multiple images with When optimizing a single image do not raise an exception if a single worker has succeeded but has reached the timeout period while running through the remaining workers. When optimizing a single image if a single worker times out it will continue on to the next worker until the global timeout is reached. Looks like there are still a couple small rubocop issues. Most of them are just about a method and block being too long and there are a couple that aren't related to this pr, so I haven't touch them. Overall, let me know what you think. |
This PR addresses the feedback what was originally given on PR toy#162 by adding a default worker specific timeout option in addition to a global timeout. The original commit discourse@8bf3c0e on PR toy#162 with just the global timeout has been in production since 2018-07-08 on Discourse instances using a forked version of this gem. We would like to get this change merged in, so that we can get off of the discourse specific fork and use the latest version of the image_optim gem. Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com> Do not raise if optimized before timeout Based on feedback this commit includes the following changes: When optimizing multiple images with `optimize_images` a single image timeout doesn't break execution. The global timeout will still raise an exception though if it is reached. When optimizing a single image do not raise an exception if a single worker has succeeded but has reached the timeout period while running through the remaining workers. When optimizing a single image if a single worker times out it will continue on to the next worker until the global timeout is reached.
838fc3c to
3a6dfaa
Compare
|
Looks like travis is showing an error when rspec is passing locally for me. Looking at the verbose info when running on travis it looks like it is related to setting the number of threads to 2. If I do the same locally I can reproduce the error when running rspec. Now that I can do that I'll see if I can come up with a fix. |
Re-opening the original PR toy#162 and replace PR toy#184 (sorry for multiple PRs). The original commit discourse/image_optim@8bf3c0e on PR toy#162 with just the global timeout has been in production since 2018-07-08 on Discourse instances using a forked version of this gem. We would like to get this change merged in, so that we can get off of the discourse specific fork and use the latest version of the image_optim gem. Add add some more details in the PR discussion. Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
Re-opening the original PR toy#162 and replacing PR toy#184 (sorry for multiple PRs). The original commit discourse/image_optim@8bf3c0e on PR toy#162 with just the global timeout has been in production since 2018-07-08 on Discourse instances using a forked version of this gem. We would like to get this change merged in, so that we can get off of the discourse specific fork and use the latest version of the image_optim gem. Going to add some more details in the PR discussion. Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
Re-opening the original PR #162 and replacing PR #184 (sorry for multiple PRs). The original commit discourse/image_optim@8bf3c0e on PR #162 with just the global timeout has been in production since 2018-07-08 on Discourse instances using a forked version of this gem. We would like to get this change merged in, so that we can get off of the discourse specific fork and use the latest version of the image_optim gem. Going to add some more details in the PR discussion. Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
Re-opening the original PR #162 and replacing PR #184 (sorry for multiple PRs). The original commit discourse/image_optim@8bf3c0e on PR #162 with just the global timeout has been in production since 2018-07-08 on Discourse instances using a forked version of this gem. We would like to get this change merged in, so that we can get off of the discourse specific fork and use the latest version of the image_optim gem. Going to add some more details in the PR discussion. Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
Re-opening the original PR toy#162 and replacing PR toy#184 (sorry for multiple PRs). The original commit discourse/image_optim@8bf3c0e on PR toy#162 with just the global timeout has been in production since 2018-07-08 on Discourse instances using a forked version of this gem. We would like to get this change merged in, so that we can get off of the discourse specific fork and use the latest version of the image_optim gem. Going to add some more details in the PR discussion. Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
Re-opening the original PR toy#162 and replacing PR toy#184 (sorry for multiple PRs). The original commit discourse/image_optim@8bf3c0e on PR toy#162 with just the global timeout has been in production since 2018-07-08 on Discourse instances using a forked version of this gem. We would like to get this change merged in, so that we can get off of the discourse specific fork and use the latest version of the image_optim gem. Going to add some more details in the PR discussion. Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
This PR addresses the feedback what was originally given on PR #162 by
adding a default worker specific timeout option in addition to a global
timeout.
The original commit
discourse@8bf3c0e
on PR #162 with just the global timeout has been in production since
2018-07-08 on Discourse instances using a forked version of this gem.
We would like to get this change merged in, so that we can get off of
the discourse specific fork and use the latest version of the
image_optim gem.
Co-authored-by: Blake Erickson o.blakeerickson@gmail.com