From a64eb57ea4839203b5ed59ded981e7abd1e3db36 Mon Sep 17 00:00:00 2001 From: divyam234 <47589864+divyam234@users.noreply.github.com> Date: Sat, 10 Aug 2024 08:55:02 +0530 Subject: [PATCH] chore: add all bots in stream --- internal/tgc/workers.go | 3 +++ pkg/services/file.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/tgc/workers.go b/internal/tgc/workers.go index ee2c7bf..ea67aa9 100644 --- a/internal/tgc/workers.go +++ b/internal/tgc/workers.go @@ -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 } diff --git a/pkg/services/file.go b/pkg/services/file.go index 75a4f46..fc3567f 100644 --- a/pkg/services/file.go +++ b/pkg/services/file.go @@ -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 {