How to control the number of Oracle queries in Node.JS?

0

In my project, a query is first performed on a database A, which returns the data of the invoices released the previous day (expiration, issuance, value, customer enrollment ...).

By using the .map () function in the result, a query is made in database B, which brings the customer information according to the enrollment.

The problem is that if 1000 invoices were issued yesterday, the system will have to do 1000 asynchronous queries on the B database, which does not support so many requests at the same time, returning only 100 and treating the others as an error.

Would there be any way to control the flow of requests to database B?

As for example, to make requests by shipment (of 100 in 100) or even to make the next requisition only when it finishes the current one (which I think would be enough time)?

PS: using the node 'oracledb'.

    
asked by anonymous 22.03.2018 / 13:45

0 answers