Problem with simultaneous incoming messages from telegram

I am building a telegram bot for tech support.
What this bot has to do:

  1. Authorize the user (get his contact)
  2. Send a menu with some knowledge base
  3. Being able to transfer messages from this user further to a app.

Here is the problem:
If I send several text messages simultaneously (with less than a second of delay) or a gallery of photos, my n8n cannot handle it, because they are all coming at the same time.
Some of the executions are failing, some of them are not even register, some of them are in the Running state, despite having timeout setup, and I am unable to Stop them. Some of them spiting out SQLITE_BUSY: database is locked.

When I attempting to Stop them, there is an error:

last 15 lines from n8n-error.log

Information on your n8n setup

  • **n8n version:0.230.3
  • **Database (default: SQLite):SQLite
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):did not changed that in env, so I guess main
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):pm2
  • **Operating system:Ubuntu 22.04.2 LTS

What should I do, to prevent this behavior? I understand, that SQLite is designed for use in single-user scenarios. Should I use another database? Or is there another solution?

Hi @inbsp :wave:

In this scenario, you could test Postgres instead of SQLite which is generally better able to deal with load scenarios, or you could simply try to throttle things to have a database load that SQLite can handle. Two examples of this would be by either sending out the messages more slowly by using Split in batches + Wait nodes if you’re using n8n to send the messages, or by using an external tool that can throttle incoming webhooks automatically.

Whichever you choose, that should fix this up for you :+1:


Thank you for a response! I will try to migrate on postgresql.

1 Like

Thanks for an advice to move to PostgreSQL.
After the migration all problems are solved.


Hi @inbsp - Glad to hear that fixed it up for you! :raised_hands:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.