Skip to content

Замотохина Мария Лаб. 2 Группа 6511#91

Open
ZamotohinaMaria wants to merge 15 commits intoitsecd:mainfrom
ZamotohinaMaria:laba2
Open

Замотохина Мария Лаб. 2 Группа 6511#91
ZamotohinaMaria wants to merge 15 commits intoitsecd:mainfrom
ZamotohinaMaria:laba2

Conversation

@ZamotohinaMaria
Copy link
Copy Markdown

ФИО: Замотохина Мария
Номер группы: 6511
Номер лабораторной: 2
Номер варианта: 6
Краткое описание предметной области: Медицинский пациент
Краткое описание добавленных фич: Реализован api gateway для класса медицинский работник на основе Ocelot, имплементирован алгоритм балансировки Weighted Round Robin, для чего была написана собственная реализация алгоритма в отдельном классе

@github-actions github-actions bot added In progress Код в процессе проверки Lab 2 Лабораторная №2. Балансировка нагрузки labels Apr 7, 2026
@github-actions github-actions bot requested a review from danlla April 7, 2026 18:22
Comment on lines +36 to +39
<details>
<summary>
Логи запуска генераторов
</summary>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Изображения в этой секции не отображаются, возможно с отступами проблемы

Comment on lines +43 to +50
for (var i = 0; i < servicesCount; i++)
{
var weight = i < _weights.Length ? _weights[i] : 1;
if (weight < 1) weight = 1;

for (var j = 0; j < weight; j++)
wheel.Add(i);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Эта реализация лучше, чем вариант при котором делается список из сервисов, но большой список в памяти можно и здесь получить, если будут большие веса
Но можно и так оставить

return new ErrorResponse<ServiceHostAndPort>(
new ServicesAreNullError("No downstream services are available"));

var wheel = BuildWheel(services.Count);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Возможно имеет смысл делать это в конструкторе 1 раз

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Вероятно лишний файл

Comment on lines +5 to +6
var builder = WebApplication.CreateBuilder(args);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не хватает builder.AddServiceDefaults();

Comment on lines +14 to +22
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(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.

Во 2 лабе cors нужно перенести в ApiGateway, так как клиент взаимодействует теперь с ним

Также нужно настроить с помощью метода WithOrigins доступ только для клиентских origins

@@ -0,0 +1,59 @@
using System.Threading;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cleanup

@ZamotohinaMaria ZamotohinaMaria requested a review from danlla April 8, 2026 19:25
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