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

fix: Overflow of backoff value. #352

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));

defectiveAi marked this conversation as resolved.
Show resolved Hide resolved
if (response == null)
{
// No cancellation token is used because we want to wait for the result
Expand Down
Loading