Skip to content

Commit b11530f

Browse files
committed
fix: change polling strategy to every 5 sec for doctrans
1 parent 2e6ecc0 commit b11530f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
### Fixed
9+
* Changed document translation to poll the server every 5 seconds. This should greatly reduce observed document translation processing time.
10+
11+
712
## [1.2.0] - 2023-03-22
813
### Added
914
* Script to check our source code for license headers and a step for them in the CI.
@@ -78,6 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7883
Initial version.
7984

8085

86+
[Unreleased]: https://github.com/DeepLcom/deepl-java/compare/v1.2.0...HEAD
8187
[1.2.0]: https://github.com/DeepLcom/deepl-java/compare/v1.1.0...v1.2.0
8288
[1.1.0]: https://github.com/DeepLcom/deepl-java/compare/v1.0.1...v1.1.0
8389
[1.0.1]: https://github.com/DeepLcom/deepl-java/compare/v1.0.0...v1.0.1

Diff for: deepl-java/src/main/java/com/deepl/api/Translator.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
// license that can be found in the LICENSE file.
44
package com.deepl.api;
55

6-
import static java.lang.Math.max;
7-
import static java.lang.Math.min;
8-
96
import com.deepl.api.http.HttpResponse;
107
import com.deepl.api.http.HttpResponseStream;
118
import com.deepl.api.parsing.Parser;
@@ -1026,11 +1023,7 @@ private void checkResponse(
10261023
}
10271024

10281025
private int calculateDocumentWaitTimeMillis(Long secondsRemaining) {
1029-
if (secondsRemaining != null) {
1030-
double secs = ((double) secondsRemaining) / 2.0 + 1.0;
1031-
secs = max(1.0, min(secs, 60.0));
1032-
return (int) (secs * 1000);
1033-
}
1034-
return 1000;
1026+
// secondsRemaining is currently unreliable, so just poll equidistantly
1027+
return 5000;
10351028
}
10361029
}

0 commit comments

Comments
 (0)