Skip to content

Commit

Permalink
add retry for slo create command
Browse files Browse the repository at this point in the history
  • Loading branch information
XmasApple committed Sep 7, 2023
1 parent 03e6e4a commit ec1bc9f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/slo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
# branches: [main]
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
Expand Down Expand Up @@ -29,7 +29,7 @@ jobs:
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}

- name: Run SLO
uses: ydb-platform/slo-tests@php-version
uses: ydb-platform/slo-tests@js-version
if: env.DOCKER_REPO != null
env:
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
Expand Down
20 changes: 16 additions & 4 deletions slo/src/Cli/CliCommands.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Reflection;
using System.Text.RegularExpressions;
using Prometheus;
using slo.Jobs;
using Ydb.Sdk;
Expand All @@ -24,8 +22,22 @@ internal static async Task Create(CreateConfig createConfig)
var executor = new Executor(tableClient);

var table = new Table(createConfig.TableName, executor);
await table.Init(createConfig.InitialDataCount, createConfig.PartitionSize, createConfig.MinPartitionsCount,
createConfig.MaxPartitionsCount);
const int maxCreateAttempts = 10;
for (var i = 0; i < maxCreateAttempts; i++)
{
try
{
await table.Init(createConfig.InitialDataCount, createConfig.PartitionSize,
createConfig.MinPartitionsCount,
createConfig.MaxPartitionsCount);
break;
}
catch (Exception e)
{
Console.WriteLine(e);
Thread.Sleep(millisecondsTimeout: 1000);
}
}
}

internal static async Task CleanUp(CleanUpConfig cleanUpConfig)
Expand Down

0 comments on commit ec1bc9f

Please sign in to comment.