xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
534 stars 120 forks source link

disable updates #100

Closed jaynlive closed 1 year ago

jaynlive commented 1 year ago

when i change DB_TYPE=mysql, find it create many records after run php server.php . when telegram receive a new message it auto create a new records.This takes up a lot of resources I guess this is caused by websocket, but I do not run the websocket service. how can i disable it.There is no need to automatically update and get messages. Can this be disabled? When I need to get new messages, I can query them myself.

xtrime-ru commented 1 year ago

Hi! First of all, when you switch storage type for your session madelineProto automatically migrate data from previous storage to new. If you have old session with big amount of cached data it can take up to 30 minutes.

After migration is done there is not much writes to database. You cant disable caching of data because it will cause errors peer not present in database and can lead to FLOOD_WAIT errors from telegram.

When you receive messages/updates madelineProto does not save them anywhere. There is only info about peers, media and some other stuff... Websocket EventHandler of TelegramApiServer is disabled if there is no websocket connections. And it does not write data to DB either.

I recommend to wait until migration is done or recreate session with new settings.