Skip to content

Commit

Permalink
num_threads
Browse files Browse the repository at this point in the history
change it to 100 to make it work - temp solution
  • Loading branch information
BennyThink committed Feb 3, 2021
1 parent 3ddfa37 commit 928cb41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ python /path/to/YYeTsBot/yyetsbot/bot.py
## health check
有时不知为何遇到了bot卡死,无任何反馈。😂这个时候需要client api了😂

好的,这个原因找到了,是因为有时爬虫会花费比较长的时间,然后pytelegrambotapi默认只有两个线程,那么后续的操作就会被阻塞住。

临时的解决办法是增加线程数量,长期的解决办法是使用celery分发任务。

# Credits

* [人人影视](http://www.zmz2019.com/)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requests
pytelegrambotapi
pytelegrambotapi==3.7.6
beautifulsoup4
tgbot-ping
redis
Expand Down
4 changes: 2 additions & 2 deletions yyetsbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
if PROXY:
apihelper.proxy = {'http': PROXY}

bot = telebot.TeleBot(TOKEN)
bot = telebot.TeleBot(TOKEN, num_threads=100)
angry_count = 0


Expand Down Expand Up @@ -365,4 +365,4 @@ def report_error(call):
scheduler = BackgroundScheduler()
scheduler.add_job(reset_request, 'cron', hour=0, minute=0)
scheduler.start()
bot.polling()
bot.polling()

0 comments on commit 928cb41

Please sign in to comment.