Taosky/telegram-search-bot

导入历史记录报错

whitecodes opened this issue · 4 comments

使用命令导入历史记录 curl -F 'file=@/XXXXX/ChatExport_2022-11-15/result.json' http://XXXXXXX:5006 得到结果

curl: (52) Empty reply from server

log如下

 * Serving Flask app 'web_manager' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://172.17.0.3:5006/ (Press CTRL+C to quit)
2022-11-20 05:10:01,746 - apscheduler.scheduler - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts
2022-11-20 05:10:01,748 - apscheduler.scheduler - INFO - Added job "set_bot_commands" to job store "default"
2022-11-20 05:10:01,748 - apscheduler.scheduler - INFO - Scheduler started
31.223.184.187 - - [20/Nov/2022 05:10:19] "GET / HTTP/1.1" 200 -
31.223.184.187 - - [20/Nov/2022 05:10:20] "GET /favicon.ico HTTP/1.1" 404 -
2022-11-20 05:10:31,598 - apscheduler.executors.default - INFO - Running job "set_bot_commands (trigger: date[2022-11-20 05:10:31 UTC], next run at: 2022-11-20 05:10:31 UTC)" (scheduled at 2022-11-20 05:10:31.594321+00:00)
2022-11-20 05:10:31,599 - apscheduler.scheduler - INFO - Removed job 7fca1cfbe0db4f019906eb5c7dd74395
2022-11-20 05:10:32,228 - apscheduler.executors.default - INFO - Job "set_bot_commands (trigger: date[2022-11-20 05:10:31 UTC], next run at: 2022-11-20 05:10:31 UTC)" executed successfully
/app/entrypoint.sh: line 3:     8 Killed                  python web_manager.py

加入bot后新记录的聊天记录是有效的,可以搜索的,就是导入历史记录有问题

log里面/app/entrypoint.sh: line 3: 8 Killed python web_manager.py,是不是内存太小进程被杀掉了?

试了下是可以的
图片

更新了导入的方式,改成了一行一行读,每次加载在一条消息的json,应该不会炸内存了。导入历史记录

可以用了,1G的VPS顺利导入成功了

以为会改用 ijson 导入