Queue Limit

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

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.

app.ts

const main = async () => {

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

  • Name
    timeout
    Type
    number
    Description

    Number of milliseconds used as maximum duration for the execution of an asynchronous function. default 20000

  • Name
    concurrencyLimit
    Type
    number
    Description

    Number of parallel processes you can be running at the same time. default 15


Guides

My first chatbot

Learn how build your first chatbot in few minutes

Read more

Concepts

Understand the essential concepts for building bots

Read more

Add Functions

The key to learning how to write flows is add-functions.

Read more

Plugins

Unlimitate and start implementing the community plugins.

Read more

Resources

Modularize

Learn how to modularise flows so that you can have a more maintainable bot.

Send Message

How to send a message via HTTP to start conversations, you can send multimedia as well.

Dockerizer

A good practice is to dockerise your bots to make them more maintainable and effective.

Events

Learning about events will make us more fluent when creating chatbots.