Skip to content

Commit

Permalink
refactor: check bot limits with total bots
Browse files Browse the repository at this point in the history
  • Loading branch information
divyam234 committed Aug 9, 2024
1 parent c714970 commit c7be0ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/services/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,15 +750,15 @@ func (fs *FileService) GetFileStream(c *gin.Context, download bool) {
multiThreads = 0

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

0 comments on commit c7be0ea

Please sign in to comment.