A
A
Andrey Rudakov2022-02-07 18:43:52
Node.js
Andrey Rudakov, 2022-02-07 18:43:52

How to force to wait for the completion of the script execution and continue (some kind of queue)?

Good afternoon.
There is a script that can be accessed by many clients, how to make it so that until the current request is processed, do not execute a new one in parallel?
For example, a request has arrived, while it is being executed, other requests are waiting.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2022-02-07
@KingstonKMS

Form a queue from client requests, make a queue handler that will feed it to the script

R
Rag'n' Code Man, 2022-02-07
@iDmitriyWinX

I have a guess that this is what you need: https://github.com/OptimalBits/bull

A
Alex Karo, 2022-02-07
@Zraza

Well, i.e. Should only one script be executed at a time? A mutex
seems to work for you . If the script is running for a long time - perhaps it really makes more sense to use queues.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question