num_threads

change it to 100 to make it work - temp solution
This commit is contained in:
BennyThink
2021-02-03 20:42:50 +08:00
parent 3ddfa372f2
commit 928cb418e7
3 changed files with 7 additions and 3 deletions

View File

@@ -107,6 +107,10 @@ python /path/to/YYeTsBot/yyetsbot/bot.py
## health check
有时不知为何遇到了bot卡死无任何反馈。😂这个时候需要client api了😂
好的这个原因找到了是因为有时爬虫会花费比较长的时间然后pytelegrambotapi默认只有两个线程那么后续的操作就会被阻塞住。
临时的解决办法是增加线程数量长期的解决办法是使用celery分发任务。
# Credits
* [人人影视](http://www.zmz2019.com/)

View File

@@ -1,5 +1,5 @@
requests
pytelegrambotapi
pytelegrambotapi==3.7.6
beautifulsoup4
tgbot-ping
redis

View File

@@ -29,7 +29,7 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(filename)s [%(le
if PROXY:
apihelper.proxy = {'http': PROXY}
bot = telebot.TeleBot(TOKEN)
bot = telebot.TeleBot(TOKEN, num_threads=100)
angry_count = 0
@@ -365,4 +365,4 @@ if __name__ == '__main__':
scheduler = BackgroundScheduler()
scheduler.add_job(reset_request, 'cron', hour=0, minute=0)
scheduler.start()
bot.polling()
bot.polling()