diff --git a/CHANGELOG.md b/CHANGELOG.md index 37904d4..4fa33ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased +### Fixed +* Changed document translation to poll the server every 5 seconds. This should greatly reduce observed document translation processing time. + ## [1.7.0] - 2023-03-22 ### Added * Script to check our source code for license headers and a step for them in the CI. diff --git a/DeepL/Translator.cs b/DeepL/Translator.cs index 44f48e7..edc287c 100644 --- a/DeepL/Translator.cs +++ b/DeepL/Translator.cs @@ -1019,9 +1019,9 @@ private static void CheckValidLanguages(string? sourceLanguageCode, string targe /// Optional hint of the number of seconds remaining. /// to wait. private static TimeSpan CalculateDocumentWaitTime(int? hintSecondsRemaining) { - var secs = ((hintSecondsRemaining ?? 0) / 2.0) + 1.0; - secs = Math.Max(1.0, Math.Min(secs, 60.0)); - return TimeSpan.FromSeconds(secs); + // hintSecondsRemaining is currently unreliable, so just poll equidistantly + const int POLLING_TIME_SECS = 5; + return TimeSpan.FromSeconds(POLLING_TIME_SECS); } /// Creates a glossary with given details.