I need to call a function multiple times from different contexts, but i need that each call fires not before that one second has passed after the previous call started. 

i'll make an example:

```
var i = 0; 
while(i<50) {
do_something(i)
i++
}

function do_something(a) {
console.log(a)
}

```

I want that this log:
'1', then after a second '2', then after a second '3', then after a second '4'...

I can't use simple setInterval or setTimeout because this function 'do\_something(param)' can be called in the same moment from different sources cause i am working with async function in nodejs. 
I want that the order of calls is kept, but that they fires with minimum delay of one second. 

I think i should add these calls to a queue, and then each second a call is dequeued and the function fires, but i really don't know how to do it in nodejs. Thank you in advance