# Queue Limit

> Implement message queues for better resource management
>
> - **Canonical URL:** https://www.builderbot.app/en/showcases/queue-limit
> - **Documentation Index:** https://www.builderbot.app/llms.txt
> - **Full Corpus:** https://www.builderbot.app/llms-full.txt

## Issue 
The problem was that when more than 60 people started a conversation in less than 20 seconds the bot did not respond to all the people.

---

## Possible Solution 

The framework by default implements a queue manager based on per-user work promises.
If you already understand the concept and you are in an environment where you receive a considerable number of recurring messages in a short period of time and you notice that it answers a large number of users but not all of them. You can try extending the process queue configuration.

__Imagine the case__ in which you receive more than 60 messages from more than 60 people in a very short period of time of less than 20 seconds for example

```mermaid
flowchart LR
    u1((User 1)) -.-> B((Bot))
    u2((User 2)) -.-> B
    u3((User 3)) -.-> B
    un((User n)) -.-> B
    style u1 fill:#ffa69e
    style u2 fill:#ffa69e
    style u3 fill:#ffa69e
    style un fill:#ffa69e
    style B fill:#1dd3b0
```
It is very likely that it will not respond to all users, since the default configuration of the bot is set to handle a smaller amount of processes, but it is very easy to modify.

```bash (app.ts)
const main = async () => {

    await createBot({
        database: new MemoryDB(),
        provider: createProvider(BaileysProvider),
        flow: createFlow([...])
    }, {
        queue: {
            timeout: 20000, //👌
            concurrencyLimit: 50 //👌
        }
    })
}
```
----

  
 Number of milliseconds used as maximum duration for the execution of an asynchronous function. __default 20000__
  
  
 Number of parallel processes you can be running at the same time. __default 15__
  

---
