This is a "multiple things are referencing the same object" issue I think.
The logic here will loop through pages and pass functions that make use of the qs object that the loop also updates. Because of this, when the requests are later fired they all reference a qs that has its page attribute set to lastPage.
I think a solution is just to push configs that are shallow copies of qs in the forloop then do a .map inside the Promise.all that will transforms them into the limit((config) => rp(config))
I noticed in logs of my local tm4 instance that the requests being fired in
tm_clock
to the paginated tm4 projects endpoint would look something likeThis is a "multiple things are referencing the same object" issue I think. The logic here will loop through pages and pass functions that make use of the qs object that the loop also updates. Because of this, when the requests are later fired they all reference a qs that has its page attribute set to
lastPage
.I think a solution is just to push configs that are shallow copies of qs in the forloop then do a .map inside the Promise.all that will transforms them into the
limit((config) => rp(config))