Skip to content

Commit f0e705e

Browse files
authored
Merge pull request #54 from GarageGroup/feature/improve-retry-logic
Improve sql retry logic
2 parents 39c035c + f49ffa6 commit f0e705e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+303
-291
lines changed

.github/workflows/publish.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
with:
5050
files: './publish/appsettings.json'
5151
env:
52-
BotInfo.BuildVersion: '${{ steps.get_version.outputs.version }}'
53-
BotInfo.BuildDateTime: '${{ steps.date.outputs.datetime }}'
52+
Info.ApiVersion: '${{ steps.get_version.outputs.version }}'
53+
Info.BuildDateTime: '${{ steps.date.outputs.datetime }}'
5454

5555
- name: Archive publish folder
5656
run: |
@@ -117,11 +117,14 @@ jobs:
117117
needs: deploy-to-test
118118

119119
steps:
120-
- name: Ping Health Check URL
121-
uses: jtalk/url-health-check-action@v3
122-
with:
123-
url: https://${{ vars.TEST_WEBAPP_NAME }}.azurewebsites.net/api/health?code=${{ secrets.TEST_BOTFUNC_KEY }}
124-
follow-redirect: false
125-
max-attempts: 3
126-
retry-delay: 5s
127-
retry-all: false
120+
- name: Get version
121+
id: get_version
122+
run: echo "version=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
123+
124+
- name: Ping Health Check URL
125+
uses: GarageGroup/platform-ping-app@v0.0.3
126+
with:
127+
health_check_url: https://${{ vars.TEST_WEBAPP_NAME }}.azurewebsites.net/api/health?code=${{ secrets.TEST_BOTFUNC_KEY }}
128+
contains: ${{ steps.get_version.outputs.version }}
129+
retry_delay_in_seconds: 15
130+
max_attempts: 10

.github/workflows/web-deploy-prod.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ jobs:
4646
needs: deploy
4747

4848
steps:
49-
- name: Ping Health Check URL
50-
uses: jtalk/url-health-check-action@v3
51-
with:
52-
url: https://${{ vars.PROD_WEBAPP_NAME }}.azurewebsites.net/api/health?code=${{ secrets.PROD_BOTFUNC_KEY }}
53-
follow-redirect: false
54-
max-attempts: 3
55-
retry-delay: 5s
56-
retry-all: false
49+
- name: Get version
50+
id: get_version
51+
run: echo "version=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
52+
53+
- name: Ping Health Check URL
54+
uses: GarageGroup/platform-ping-app@v0.0.3
55+
with:
56+
health_check_url: https://${{ vars.PROD_WEBAPP_NAME }}.azurewebsites.net/api/health?code=${{ secrets.PROD_BOTFUNC_KEY }}
57+
contains: ${{ steps.get_version.outputs.version }}
58+
retry_delay_in_seconds: 15
59+
max_attempts: 10

.github/workflows/web-deploy-test.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ jobs:
4646
needs: deploy
4747

4848
steps:
49-
- name: Ping Health Check URL
50-
uses: jtalk/url-health-check-action@v3
51-
with:
52-
url: https://${{ vars.TEST_WEBAPP_NAME }}.azurewebsites.net/api/health?code=${{ secrets.TEST_BOTFUNC_KEY }}
53-
follow-redirect: false
54-
max-attempts: 3
55-
retry-delay: 5s
56-
retry-all: false
49+
- name: Get version
50+
id: get_version
51+
run: echo "version=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
52+
53+
- name: Ping Health Check URL
54+
uses: GarageGroup/platform-ping-app@v0.0.3
55+
with:
56+
health_check_url: https://${{ vars.TEST_WEBAPP_NAME }}.azurewebsites.net/api/health?code=${{ secrets.TEST_BOTFUNC_KEY }}
57+
contains: ${{ steps.get_version.outputs.version }}
58+
retry_delay_in_seconds: 15
59+
max_attempts: 10

src/app/AzureFunc/Applicaton/BotFlow/Flow.BotInfo.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ private static IBotBuilder UseBotInfoFlow(this IBotBuilder botBuilder)
1515
private static BotInfoData GetBotInfoData(IBotContext botContext)
1616
=>
1717
new(
18-
botContext.ServiceProvider.GetRequiredService<IConfiguration>().GetRequiredSection("BotInfo").GetBotInfoData());
18+
botContext.ServiceProvider.GetRequiredService<IConfiguration>().GetRequiredSection("Info").GetBotInfoData());
1919

2020
private static FlatArray<KeyValuePair<string, string?>> GetBotInfoData(this IConfigurationSection section)
2121
=>
22-
new(
23-
new("Название", section["Name"]),
22+
[
23+
new("Название", section["ApiName"]),
2424
new("Описание", section["Description"]),
25-
new("Версия сборки", section["BuildVersion"]),
26-
new("Время сборки", section.GetValue<DateTimeOffset?>("BuildDateTime").ToRussianStandardTimeZoneString()));
25+
new("Версия сборки", section["ApiVersion"]),
26+
new("Время сборки", section.GetValue<DateTimeOffset?>("BuildDateTime").ToRussianStandardTimeZoneString())
27+
];
2728
}

src/app/AzureFunc/Applicaton/BotFlow/Flow.IncidentCreate.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ private static SupportGptApiOption ResolveSupportGptApiOption(IServiceProvider s
5959
var incidentCompleteSection = gptApiSection.GetRequiredSection(IncidentCompleteSectionName);
6060

6161
var incidentComplete = new IncidentCompleteOption(
62-
chatMessages: new(
62+
chatMessages:
63+
[
6364
new(
6465
role: "system",
6566
contentTemplate: incidentCompleteSection["SystemTemplate"].OrEmpty()),
6667
new(
6768
role: "user",
68-
contentTemplate: incidentCompleteSection["UserTemplate"].OrEmpty())))
69+
contentTemplate: incidentCompleteSection["UserTemplate"].OrEmpty())
70+
])
6971
{
7072
MaxTokens = incidentCompleteSection.GetValue<int?>("MaxTokens"),
7173
Temperature = incidentCompleteSection.GetValue<decimal?>("Temperature")

src/app/AzureFunc/AzureFunc.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="GarageGroup.Infra.Azure.DurableTask" Version="0.5.1" />
31-
<PackageReference Include="GarageGroup.Infra.Azure.Hosting" Version="0.6.1" />
30+
<PackageReference Include="GarageGroup.Infra.Azure.DurableTask" Version="0.6.0" />
31+
<PackageReference Include="GarageGroup.Infra.Azure.Hosting" Version="0.8.0" />
3232
<PackageReference Include="GarageGroup.Infra.Azure.Services.AzureUser.Api" Version="0.1.1" />
3333
<PackageReference Include="GarageGroup.Infra.Bot.Builder.Authorization.Dataverse" Version="0.4.0" />
3434
<PackageReference Include="GarageGroup.Infra.Bot.Builder.Command.Info" Version="0.2.0" />
3535
<PackageReference Include="GarageGroup.Infra.Bot.Builder.Command.Stop" Version="0.2.0" />
3636
<PackageReference Include="GarageGroup.Infra.Bot.Builder.Integration.Handler" Version="0.4.0" />
3737
<PackageReference Include="GarageGroup.Infra.Bot.Builder.Integration.Storage.CosmosDb" Version="0.5.0" />
38-
<PackageReference Include="GarageGroup.Infra.Dataverse.Api" Version="3.15.0" />
38+
<PackageReference Include="GarageGroup.Infra.Dataverse.Api" Version="3.16.0" />
3939
<PackageReference Include="GarageGroup.Infra.Dataverse.DataverseUser.Api" Version="1.3.0" />
40-
<PackageReference Include="GarageGroup.Infra.HealthCheck.Handler" Version="0.0.1" />
40+
<PackageReference Include="GarageGroup.Infra.HealthCheck.Handler" Version="0.3.0" />
4141
<PackageReference Include="GarageGroup.Infra.Http.Polly" Version="1.2.0" />
42-
<PackageReference Include="GarageGroup.Infra.Sql.Api" Version="2.4.0" />
43-
<PackageReference Include="GarageGroup.Infra.Sql.Api.Provider.Dataverse" Version="0.0.1" />
42+
<PackageReference Include="GarageGroup.Infra.Sql.Api" Version="2.6.0" />
43+
<PackageReference Include="GarageGroup.Infra.Sql.Api.Provider.Dataverse" Version="0.1.0" />
4444
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
4545
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" OutputItemType="Analyzer" />
4646
<PackageReference Include="PrimeFuncPack.DependencyRegistry" Version="2.1.0" />

src/app/AzureFunc/appsettings.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"BotInfo": {
3-
"Name": "Garage Support Bot",
2+
"Info": {
3+
"ApiName": "Garage Support Bot",
44
"Description": "Бот для работы с инцидентами Garage Group",
5-
"BuildVersion": "",
5+
"ApiVersion": "",
66
"BuildDateTime": ""
77
},
88
"OAuthConnectionName": "BotOAuthConnection",
@@ -21,6 +21,8 @@
2121
"AuthClientId": "",
2222
"AuthClientSecret": "",
2323
"EnvironmentId": "",
24+
"ConnectionTimeout": 240,
25+
"CommandTimeout": 240,
2426
"DbRetryPolicy": {
2527
"NumberOfTries": 5,
2628
"DeltaTime": "00:00:01",

src/endpoint/Incident.Create/Flow/Step.AwaitCaseType/CaseTypeAwaitHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ internal static class CaseTypeAwaitHelper
1111

1212
static CaseTypeAwaitHelper()
1313
{
14-
var caseTypes = new CaseTypeValue[]
15-
{
14+
CaseTypeValue[] caseTypes =
15+
[
1616
new(IncidentCaseTypeCode.Question, "Вопрос"),
1717
new(IncidentCaseTypeCode.Problem, "Проблема"),
1818
new(IncidentCaseTypeCode.Request, "Запрос")
19-
};
19+
];
2020

2121
valueStepOption = new(
2222
messageText: "Выберите тип обращения",

src/endpoint/Incident.Create/Flow/Step.AwaitPriority/PriorityAwaitHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ internal static class PriorityAwaitHelper
1111

1212
static PriorityAwaitHelper()
1313
{
14-
var caseTypes = new PriorityValue[]
15-
{
14+
PriorityValue[] caseTypes =
15+
[
1616
new(IncidentPriorityCode.Hight, "Высокий"),
1717
new(IncidentPriorityCode.Normal, "Обычный"),
1818
new(IncidentPriorityCode.Low, "Низкий")
19-
};
19+
];
2020

2121
valueStepOption = new(
2222
messageText: "Выберите приоритет",

src/endpoint/Incident.Create/Flow/Step.ConfirmIncident/IncidentConfirmFlowStep.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
31
using GarageGroup.Infra.Bot.Builder;
42

53
namespace GarageGroup.Internal.Support;
@@ -17,12 +15,14 @@ private static ConfirmationCardOption CreateOption(IChatFlowContext<IncidentCrea
1715
confirmButtonText: "Создать",
1816
cancelButtonText: "Отменить",
1917
cancelText: "Создание инцидента было отменено",
20-
fieldValues: new FlatArray<KeyValuePair<string, string?>>(
18+
fieldValues:
19+
[
2120
new("Заголовок", context.FlowState.Title),
2221
new("Клиент", context.FlowState.CustomerTitle),
2322
new("Контакт", context.FlowState.ContactFullName ?? "--"),
2423
new("Тип обращения", context.FlowState.CaseTypeTitle),
2524
new("Приоритет", context.FlowState.PriorityTitle),
2625
new("Ответственный", context.FlowState.OwnerFullName),
27-
new("Описание", context.FlowState.Description)));
26+
new("Описание", context.FlowState.Description)
27+
]);
2828
}

0 commit comments

Comments
 (0)