mirror of
https://github.com/tgdrive/teldrive.git
synced 2024-11-14 11:45:29 +08:00
refactor: check bot limits with total bots
This commit is contained in:
parent
c7149701f1
commit
c7be0ead76
1 changed files with 2 additions and 2 deletions
|
@ -750,7 +750,7 @@ func (fs *FileService) GetFileStream(c *gin.Context, download bool) {
|
||||||
multiThreads = 0
|
multiThreads = 0
|
||||||
|
|
||||||
} else if fs.cnf.TG.DisableBgBots && len(tokens) > 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)
|
token, _ = fs.botWorker.Next(file.ChannelID)
|
||||||
client, err = tgc.BotClient(c, fs.kv, &fs.cnf.TG, token)
|
client, err = tgc.BotClient(c, fs.kv, &fs.cnf.TG, token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -758,7 +758,7 @@ func (fs *FileService) GetFileStream(c *gin.Context, download bool) {
|
||||||
}
|
}
|
||||||
multiThreads = 0
|
multiThreads = 0
|
||||||
} else {
|
} 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)
|
c, err := fs.worker.Next(file.ChannelID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fs.handleError(err, w)
|
fs.handleError(err, w)
|
||||||
|
|
Loading…
Reference in a new issue