Skip to content

Commit

Permalink
fix: change polling strategy to every 5 sec for doctrans
Browse files Browse the repository at this point in the history
  • Loading branch information
JanEbbing committed Apr 13, 2023
1 parent d5580f5 commit 0eab96f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions DeepL/Translator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,9 +1019,9 @@ private static void CheckValidLanguages(string? sourceLanguageCode, string targe
/// <param name="hintSecondsRemaining">Optional hint of the number of seconds remaining.</param>
/// <returns><see cref="TimeSpan" /> to wait.</returns>
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);
}

/// <summary>Creates a glossary with given details.</summary>
Expand Down

0 comments on commit 0eab96f

Please sign in to comment.