Skip to content

Commit

Permalink
enable batching in video
Browse files Browse the repository at this point in the history
  • Loading branch information
nkonev committed Sep 12, 2024
1 parent 5b7a019 commit e57927f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions video/tasks/chat_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,23 @@ func (srv *ChatDialerService) processBatch(ctx context.Context, tx *db.Tx, chatI
GetLogEntry(ctx).Error(err, "Failed during getting chat invite names")
}

for _, st := range batchUserStates {
// we can do it, because
// 1. batchUserStates is not empty
// 2. st.OwnerAvatar <-> ownerId, st.ChatTetATet <-> chatId from the args of this function
st := batchUserStates[0]
realOwnerId := ownerId
if realOwnerId == db.NoUser {
realOwnerId = st.UserId
}

m := map[int64]string{}
for _, state := range batchUserStates {
// cleanNotNeededAnymoreDialData - should be before status == services.CallStatusNotFound exit
srv.cleanNotNeededAnymoreDialData(ctx, tx, chatId, st)
srv.cleanNotNeededAnymoreDialData(ctx, tx, chatId, state)

m := map[int64]string{st.UserId: st.Status}
realOwnerId := ownerId
if realOwnerId == db.NoUser {
realOwnerId = st.UserId
}
srv.stateChangedEventService.SendDialEvents(ctx, chatId, m, realOwnerId, utils.NullToEmpty(st.OwnerAvatar), st.ChatTetATet, inviteNames)
m[state.UserId] = state.Status
}
srv.stateChangedEventService.SendDialEvents(ctx, chatId, m, realOwnerId, utils.NullToEmpty(st.OwnerAvatar), st.ChatTetATet, inviteNames)
}

func (srv *ChatDialerService) cleanNotNeededAnymoreDialData(
Expand Down

0 comments on commit e57927f

Please sign in to comment.