Skip to content

Commit 46c6ef6

Browse files
authored
Implement backoff for InsertOverPartitionLimit test (Azure#28260)
1 parent 781b52e commit 46c6ef6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/EntityBindingLiveTests.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,16 +1365,21 @@ private class InsertOverPartitionLimitProgram
13651365
{
13661366
public async Task Call([Table(TableNameExpression)] IAsyncCollector<TableEntity> collector, EntityBindingLiveTests test)
13671367
{
1368+
int delay = 5000;
1369+
int maxRetries = 5;
1370+
int retries = 1;
13681371
for (int i = 0; i < TableEntityWriter.MaxPartitionWidth + 10; i++)
13691372
{
13701373
try
13711374
{
13721375
await collector.AddAsync(new TableEntity(i.ToString(), i.ToString()) { ["Value"] = i });
13731376
}
1374-
catch (FunctionInvocationException ex) when(ex.InnerException is TableTransactionFailedException ttfe && ttfe.Status == 429)
1377+
catch (FunctionInvocationException ex) when(ex.InnerException is TableTransactionFailedException ttfe && ttfe.Status == 429 && retries <= maxRetries)
13751378
{
1376-
await test.Delay(3000);
1377-
await collector.AddAsync(new TableEntity(i.ToString(), i.ToString()) { ["Value"] = i });
1379+
await test.Delay(delay);
1380+
delay *= 2;
1381+
retries++;
1382+
i--;
13781383
}
13791384
}
13801385
}
@@ -1498,4 +1503,4 @@ public override int GetHashCode()
14981503
}
14991504
}
15001505
}
1501-
}
1506+
}

0 commit comments

Comments
 (0)