Skip to content
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

Calculate the default timeout correctly #6287

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

matthias-ronge
Copy link
Collaborator

Due to a unit mix-up, the default timeout was only set to 1/60 of the intended time period, which occasionally causes errors in large images that you have to find first.

Due to a unit mix-up, the default timeout was only set to 1/60 of the intended time period, which occasionally causes errors in large images that you have to find first.
@matthias-ronge matthias-ronge marked this pull request as ready for review October 31, 2024 16:43
@solth solth requested a review from stweil November 8, 2024 16:52
Copy link
Member

@stweil stweil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the code changes fix a bug (so might also be backported), and my two comments are only suggestions for optional small improvements.

@@ -51,7 +51,7 @@ class ConvertRunner {
/**
* Default timeout.
*/
private static final int DEFAULT_TIMEOUT_MINS = (int) TimeUnit.MINUTES.convert(2, TimeUnit.HOURS);
private static final int DEFAULT_TIMEOUT_SECS = (int) TimeUnit.SECONDS.convert(2, TimeUnit.HOURS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether 7200, 2 * 3600 or 2 * 60 * 60 would not be easier to read. At least it would avoid the type cast.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type cast could also be avoided by using a long DEFAULT_TIMEOUT_SECS and KitodoConfig.getLongParameter below.

@@ -51,7 +51,7 @@ class ConvertRunner {
/**
* Default timeout.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we have a speaking variable name, "Default timeout (seconds)" or a similar description might help additionally.

@solth solth merged commit cf373a2 into kitodo:master Nov 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants