Issues with data table lookups when running a Telegram bot from a Background Task

Using threads on the server is not safe:

I’m sure you can’t use app_tables from an unofficial thread, and I would be afraid that Anvil would kill that thread whenever it likes.

I don’t know your library, but I always stay away from creating my own threads and try to use callbacks to http endpoints instead. The http endpoint can always use app_tables or start a background task.

2 Likes