[WTEL-10383]feature(broker): add creating system online skill on new - #502
[WTEL-10383]feature(broker): add creating system online skill on new#502suifri wants to merge 1 commit into
Conversation
🤖 Webitel Code ReviewЦей пулреквест додає обробник подій створення домену для автоматичного створення системних навичок (online skills) для нових доменів. Для цього реалізовано новий загальний споживач черг RabbitMQ ( 📋 Walkthrough (10 файл(и/ів))
Знахідки
🔸 Дрібниці / nitpicks (1)
🔗 Cross-repo callers змінених символів (14)
Index-grounded review across the Webitel codebase. Знахідки можуть бути неточними — перевіряйте перед застосуванням. |
| ) | ||
|
|
||
| type DomainEvent struct { | ||
| ID int |
There was a problem hiding this comment.
Використовуйте int64 для ID домену для узгодженості з рештою кодової бази.
| ID int | |
| ID int64 |
|
|
||
| const domainIdIndex = 2 | ||
|
|
||
| parsedDomainId, err := strconv.Atoi(splitted[domainIdIndex]) |
There was a problem hiding this comment.
Парсинг ID домену як int64.
| parsedDomainId, err := strconv.Atoi(splitted[domainIdIndex]) | |
| parsedDomainId, err := strconv.ParseInt(splitted[domainIdIndex], 10, 64) |
| ch, err := b.getChannel() | ||
| if err != nil { | ||
| b.log.Error("getting AMQP channel", wlog.Err(err)) | ||
| if !b.sleep() { |
There was a problem hiding this comment.
Передавайте контекст у метод sleep для швидкого реагування на скасування.
| if !b.sleep() { | |
| if !b.sleep(ctx) { |
|
|
||
| if err := b.setup(ch); err != nil { | ||
| b.log.Error("setup queue", wlog.Err(err)) | ||
| if !b.sleep() { |
There was a problem hiding this comment.
Передавайте контекст у метод sleep.
| if !b.sleep() { | |
| if !b.sleep(ctx) { |
|
|
||
| if err != nil { | ||
| b.log.Error("consuming queue deliveries", wlog.Err(err)) | ||
| if !b.sleep() { |
There was a problem hiding this comment.
Передавайте контекст у метод sleep.
| if !b.sleep() { | |
| if !b.sleep(ctx) { |
| Delete(ctx context.Context, deleteCmd *model.DeleteSkillPresetCmd) model.AppError | ||
| Search(ctx context.Context, search *model.SearchOnlineSkillsQuery) ([]*model.OnlineSkills, model.AppError) | ||
| Get(ctx context.Context, search *model.GetSkillPresetQuery) (*model.OnlineSkills, model.AppError) | ||
| CreateSystem(cxt context.Context, domainID int) model.AppError |
There was a problem hiding this comment.
Виправлення типу domainID на int64 та імені контексту на ctx.
| CreateSystem(cxt context.Context, domainID int) model.AppError | |
| CreateSystem(ctx context.Context, domainID int64) model.AppError |
| return result, nil | ||
| } | ||
|
|
||
| func (s *SqlOnlineSkillsStore) CreateSystem(ctx context.Context, domainID int) model.AppError { |
There was a problem hiding this comment.
Зміна типу domainID на int64.
| func (s *SqlOnlineSkillsStore) CreateSystem(ctx context.Context, domainID int) model.AppError { | |
| func (s *SqlOnlineSkillsStore) CreateSystem(ctx context.Context, domainID int64) model.AppError { |
f1e0a34 to
fc11f74
Compare
| app.MessageQueue.Start() | ||
| app.initDomainEventListener() |
There was a problem hiding this comment.
Ініціалізуйте слухач подій доменів перед запуском черги повідомлень, щоб уникнути втрати подій, які вже є в черзі на момент старту.
| app.MessageQueue.Start() | |
| app.initDomainEventListener() | |
| app.initDomainEventListener() | |
| app.MessageQueue.Start() |
45108e6 to
1b685ca
Compare
domain event - add creation of simple topic broker queue - add queue configuration object - add new domain created handler
1b685ca to
3ffdcb7
Compare
| if len(splitted) < 3 { | ||
| return nil, NewBadRequestError( | ||
| "model.domain.new_domain_event.invalid_rk_len", | ||
| "received roting key with len less than 3", |
There was a problem hiding this comment.
Виправлення друкарської помилки
| "received roting key with len less than 3", | |
| "received routing key with len less than 3", |
domain event