tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Disable storing messages #2897

Closed maxstaniforth closed 5 months ago

maxstaniforth commented 5 months ago

Hi,

I have an application where once a telegram account is authorised, it listens for tdlib events and then sends them onto a kafka topic. The application has no need to store any messages within the sqlite or memory once the event is sent to the topic.

Is there a way to disable the saving of messages so the application doesn't run out of disk space/memory? And if not what would the effect of simply deleting the sqlite database be after the account is authorised? Would the messages be start being saved to memory again.

Thanks

levlam commented 5 months ago

There is no way, because the data is required to send correct updates to the app.

The file sqlite.db can be manually deleted when the corresponding TDLib instance is closed, but then secret chat messages, local chat settings and some other instance-specific information is lost.

maxstaniforth commented 5 months ago

Thanks for such a quick response.

When you say the data is required to send correct updates, is that only necessary for when the update originates from my application. If my application never sends any updates itself, only listens for when updates come from other sessions, is there still a need for the sqlite db to store the messages?

levlam commented 5 months ago

Yes.

maxstaniforth commented 5 months ago

And if the sqlite database is deleted before the TdLib instance is closed are the messages then stored within memory?

levlam commented 5 months ago

If you delete database of the running instance, then the app is likely to crash.

maxstaniforth commented 5 months ago

ok thanks