Skip to content

Commit

Permalink
chore: add all bots in stream
Browse files Browse the repository at this point in the history
  • Loading branch information
divyam234 committed Aug 10, 2024
1 parent c7be0ea commit a64eb57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/tgc/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func NewBotWorker() *BotWorker {
func (w *BotWorker) Set(bots []string, channelID int64) {
w.mu.Lock()
defer w.mu.Unlock()
if _, ok := w.bots[channelID]; ok {
return
}
w.bots[channelID] = bots
w.currIdx[channelID] = 0
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ func (fs *FileService) GetFileStream(c *gin.Context, download bool) {
multiThreads = 0

} else if fs.cnf.TG.DisableBgBots && len(tokens) > 0 {
fs.botWorker.Set(tokens[0:min(len(tokens), fs.cnf.TG.Stream.BotsLimit)], file.ChannelID)
fs.botWorker.Set(tokens, file.ChannelID)
token, _ = fs.botWorker.Next(file.ChannelID)
client, err = tgc.BotClient(c, fs.kv, &fs.cnf.TG, token)
if err != nil {
Expand Down

0 comments on commit a64eb57

Please sign in to comment.