Skip to content

Commit

Permalink
fix: Overflow of backoff value. (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
defectiveAi authored Sep 13, 2024
1 parent 76a8d5d commit c6176a9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions source/Databricks/documents/release-notes/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Databricks Release Notes

## Version 11.2.4

- Fix overflow of backoff value.

## Version 11.2.3

- Skip tests
Expand Down
2 changes: 1 addition & 1 deletion source/Databricks/source/Jobs/Jobs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ limitations under the License.

<PropertyGroup>
<PackageId>Energinet.DataHub.Core.Databricks.Jobs</PackageId>
<PackageVersion>11.2.3$(VersionSuffix)</PackageVersion>
<PackageVersion>11.2.4$(VersionSuffix)</PackageVersion>
<Title>Databricks Jobs</Title>
<Company>Energinet-DataHub</Company>
<Authors>Energinet-DataHub</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ limitations under the License.

<PropertyGroup>
<PackageId>Energinet.DataHub.Core.Databricks.SqlStatementExecution</PackageId>
<PackageVersion>11.2.3$(VersionSuffix)</PackageVersion>
<PackageVersion>11.2.4$(VersionSuffix)</PackageVersion>
<Title>Databricks SQL Statement Execution</Title>
<Company>Energinet-DataHub</Company>
<Authors>Energinet-DataHub</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,17 @@ public async ValueTask<DatabricksStatementResponse> WaitForSqlWarehouseResultAsy
{
DatabricksStatementResponse? response = null;
var fibonacci = new Fibonacci();
var currentDelay = 0;

do
{
try
{
var delayInMilliseconds = Math.Min(fibonacci.GetNextNumber() * 10, MaxWaitTimeForLoopInMilliseconds);
response = await GetResponseFromDataWarehouseAsync(client, endpoint, response, delayInMilliseconds, cancellationToken).ConfigureAwait(false);
currentDelay = currentDelay < MaxWaitTimeForLoopInMilliseconds
? fibonacci.GetNextNumber() * 10
: MaxWaitTimeForLoopInMilliseconds;

response = await GetResponseFromDataWarehouseAsync(client, endpoint, response, currentDelay, cancellationToken).ConfigureAwait(false);
if (response.IsSucceeded)
return response;

Expand Down Expand Up @@ -103,9 +108,6 @@ private async Task<DatabricksStatementResponse> GetResponseFromDataWarehouseAsyn
int delayInMilliseconds,
CancellationToken cancellationToken)
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(delayInMilliseconds, nameof(delayInMilliseconds));
ArgumentOutOfRangeException.ThrowIfGreaterThan(delayInMilliseconds, MaxWaitTimeForLoopInMilliseconds, nameof(delayInMilliseconds));

if (response == null)
{
// No cancellation token is used because we want to wait for the result
Expand Down

0 comments on commit c6176a9

Please sign in to comment.