Skip to content

Кадников Николай Лаб. 2 Группа 6513#41

Open
Airfix982 wants to merge 11 commits intoitsecd:mainfrom
Airfix982:feature/balancer
Open

Кадников Николай Лаб. 2 Группа 6513#41
Airfix982 wants to merge 11 commits intoitsecd:mainfrom
Airfix982:feature/balancer

Conversation

@Airfix982
Copy link

ФИО: Кадников Николай
Номер группы: 6513
Номер лабораторной: 2
Номер варианта: 42
Краткое описание предметной области: Программный проект
Краткое описание добавленных фич: Добавлены балансировщик нагрузки и реплицирование

@github-actions github-actions bot added In progress Код в процессе проверки Lab 2 Лабораторная №2. Балансировка нагрузки labels Mar 10, 2026
@github-actions github-actions bot requested a review from alxmcs March 10, 2026 23:32
Copy link
Collaborator

@alxmcs alxmcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Общее замечание: запустить клинап по солюшену


var cache = builder.AddRedis("programproj-cache").WithRedisInsight(containerName: "programproj-insight");

var ports = builder.Configuration.GetSection("ApiGateway:Ports").Get<int[]>() ?? throw new InvalidOperationException("api gw ports r not configured");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хотелось бы более вменяемое сообщение об ошибке

var apiGW = builder.AddProject<Projects.Service_ApiGw>("api-gw", project => { project.ExcludeLaunchProfile = true; })
.WithHttpEndpoint(port: 5247)
.WithHttpsEndpoint(port: 7198);
foreach (var service in apiServices) apiGW.WaitFor(service);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Убрать в цикл выше
Короче, такая же история, как и в #38, так что можешь посмотреть подробные комментарии там

.WithHttpsEndpoint(port: 7198);
foreach (var service in apiServices) apiGW.WaitFor(service);
builder.AddProject<Projects.Client_Wasm>("programproj-wasm")
.WithReference(apiGW)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тебе WithReference() тут не поможет, потому что это серверная функциональность, а у тебя стеналон васм, который запускается в браузере

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Какой еще weatherforecast?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это по дефолту создалось, не заметил

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я бы сказал, что название данного проекта нарушает шарповые конвенции именования

{
var services = await _services();
if (services == null || services.Count == 0) {
throw new InvalidOperationException("no downstreaam services");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если бы это был настоящий программный продукт, тебя бы распяли за такое сообщение об ошибке

{
return new OkResponse<ServiceHostAndPort>(services[0].HostAndPort);
}
var idxx = Math.Abs(id % services.Count);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут я бы тоже сказал, что конвенции именования нарушены
Или это просто печатка, как и со downstreaam, хз

using Ocelot.DownstreamRouteFinder.Finder;
using Ocelot.Errors;

namespace Service.ApiGw.balancer;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Неймспейс нарушает правила именования

});
var app = builder.Build();

app.MapDefaultEndpoints();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тебе зачем эти эндпоинты кроме как в дев среде?

Comment on lines +4 to +5
using Service.ApiGw.balancer;
var builder = WebApplication.CreateBuilder(args);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну добавь ты пустую строку между юзингами и непосредственно кодом, жопа от этого ни у кого не отвалится, зато исходник будет более читаемый

@Airfix982 Airfix982 requested a review from alxmcs March 13, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In progress Код в процессе проверки Lab 2 Лабораторная №2. Балансировка нагрузки

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants