You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here it shows a Promise.all does not longer keep the process alive, it terminates... I guess this ratelimiter was implemented with daemonized scripts in mind?
constaxios=require('axios')constrl=require('axios-rate-limit');// sets max 2 requests per 1 second, other will be delayedconsthttp=rl(axios.create(),{maxRequests: 2,perMilliseconds: 1000});Promise.all([http.get('http://httpbin.org/get').then(x=>{console.log(1);returnx}),http.get('http://httpbin.org/get').then(x=>{console.log(2);returnx}),http.get('http://httpbin.org/get').then(x=>{console.log(3);returnx}),]).then(x=>{console.log('after')})
Problem workaround
If you count yourself how many requests you scheduled and if they are all finished or just add a global timeout to keep the process alive it works:
constaxios=require('axios')constrl=require('axios-rate-limit');// sets max 2 requests per 1 second, other will be delayedconsthttp=rl(axios.create(),{maxRequests: 2,perMilliseconds: 1000});Promise.all([http.get('http://httpbin.org/get').then(x=>{console.log(1);returnx}),http.get('http://httpbin.org/get').then(x=>{console.log(2);returnx}),http.get('http://httpbin.org/get').then(x=>{console.log(3);returnx}),]).then(x=>{console.log('after')})setTimeout(function(){console.log('kept alive for 5s')},5000)
The text was updated successfully, but these errors were encountered:
Problem example
Here it shows a Promise.all does not longer keep the process alive, it terminates... I guess this ratelimiter was implemented with daemonized scripts in mind?
Problem workaround
If you count yourself how many requests you scheduled and if they are all finished or just add a global timeout to keep the process alive it works:
The text was updated successfully, but these errors were encountered: