Meteor build delay in iteration through collection



I have created a stackoverflow topic, but i have yet no solution.
The problem is i have in my db many documents and i want iterate it and for each row i want
build some delay based on the duration-field of the actually processed collection.
Then for the next collection the same process with delay.

Here is the orginal question:

With Meteor._sleepForMs(data[i].duration*1000); for the first collections it delays correctly, but then it has a unexpected behaviour with different delays.

Also the solution with fibers doesn’t process correctly.


start: function() {
let data = Strategy.find({}, {limit: 5}).fetch();
for (let i = 0; i < data.length; ++i) {
mqttClient.publish(“test”, data[i].charge);