ehForwarderBot / efb-telegram-master

EFB Telegram Master Channel, a channel for EH Forwarder Bot.
GNU Affero General Public License v3.0
223 stars 78 forks source link

after tgdata.db become lager, telegram can't send message to wechat, and there are no error log. #111

Open QQ-War opened 2 years ago

QQ-War commented 2 years ago

I set the flag to send to last chat by default. after 5 month use, the size of tgdata.db reach to 19M.

now, telegram can receive message from wechat, no problem. but if I sent message, which only arrive to the server running ehforwarderbot, and it will not send to wechat.

if I run this bot by ehforwarderbot -v, there will be no error log. only you can see, after telegram master get the message, it only handle by efb_telegram_master.locale_handler. normally, the next step is efb_telegram_master.master_message, but it doesn't happen.

After i clear the table msglog, and test for two days, seems ok.

blueset commented 2 years ago

Thanks for experimenting and the detailed report. I’ll try to investigate on the cause of the issue and a solution for it. If you have any better idea on fixing the code, feel free to comment below or send in a PR.

QQ-War commented 2 years ago

Thanks for quick response.

  1. My temporary solution is to create a task to backup the msglog and clean this table every night. maybe the backup is not necessary ,since all message is already inside telegram.
  2. My code skill is not that good, I would like to help to check the code in depth, but maybe can help less. My thinking on this issues is maybe because of the read and write of big file takes a lot of time, then the database is locked by wechat slave, so the telegram master can only set the locale and don't have resouce to handle message. One suggestion is to give an option to use Mysql.

45 23 sqlite3 /home/ubuntu/.ehforwarderbot/profiles/default/blueset.telegram/tgdata.db '.dump msglog'>/home/ubuntu/.ehforwarderbot/profiles/default/blueset.telegram/msglog.sql 55 23 sqlite3 /home/ubuntu/.ehforwarderbot/profiles/default/blueset.telegram/tgdata.db.bak '.read /home/ubuntu/.ehforwarderbot/profiles/default/blueset.telegram/msglog.sql' 0 0 * sqlite3 /home/ubuntu/.ehforwarderbot/profiles/default/blueset.telegram/tgdata.db 'delete from msglog;'