Skip to content

Белякова Вероника Лаб. 2 Группа 6511#78

Open
Cat-sandwich wants to merge 7 commits intoitsecd:mainfrom
Cat-sandwich:main
Open

Белякова Вероника Лаб. 2 Группа 6511#78
Cat-sandwich wants to merge 7 commits intoitsecd:mainfrom
Cat-sandwich:main

Conversation

@Cat-sandwich
Copy link
Copy Markdown

ФИО: Белякова Вероника
Номер группы: 6511
Номер лабораторной: 2
Номер варианта: 2
Краткое описание предметной области: Сотрудник компании
Краткое описание добавленных фич: Выполнена балансировка нагрузки согласно варианту (алгоритм Query Based)

@github-actions github-actions bot added In progress Код в процессе проверки Lab 2 Лабораторная №2. Балансировка нагрузки labels Mar 29, 2026
@github-actions github-actions bot requested a review from danlla March 29, 2026 12:20
Comment on lines +7 to +27
var generators = new List<IResourceBuilder<ProjectResource>>();

for (var i = 1; i <= 3; i++)
{
var generator = builder
.AddProject<Projects.Employee_ApiService>($"generator-{i}")
.WithReference(redis)
.WithHttpEndpoint(name: $"http{i}", port: 5200 + i);

generators.Add(generator);
}

var apiGateway = builder.AddProject<Projects.Employee_ApiGateway>("employee-apigateway")
.WithHttpEndpoint(name: "gateway", port: 5200);

foreach (var generator in generators)
{
apiGateway
.WithReference(generator)
.WaitFor(generator);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно создание apiGateway перенести до цикла с созданием генераторов и тогда не нужны будут generators и цикл

foreach (var generator in generators)
{
    apiGateway
        .WithReference(generator)
        .WaitFor(generator);
}

Comment on lines +19 to +27
builder.Services.AddCors(options =>
{
options.AddPolicy("wasm", policy =>
{
policy.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В принципе от cors в этом проекте можно избавиться, так как браузер теперь взаимодействует с api gateway

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

А сюда нужно добавить cors и настроить его так, чтобы разрешенным origin был клиент

$"Routes:0:DownstreamHostAndPorts:{i}:Port", uri.Port.ToString()));
}

if (overrides.Any())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if (overrides.Count != 0)

{
var generator = builder
.AddProject<Projects.Employee_ApiService>($"generator-{i}")
.WithReference(redis)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужно сюда добавить еще .WaitFor(redis);

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