0

am trying to figure out if the following code will cause stack overflow or not, can someone please help

function testing() {
    setTimeout(() => {
        testing()
    },100 )
}

testing()

I am trying to use redis blpop command as an event queue and want to process the next message as soon as I am done with one

3
  • no, why should it? Commented Jan 20, 2022 at 14:15
  • because its an recursive function Commented Jan 20, 2022 at 14:17
  • It would cause stackoverflow if there was no setTimeout. With setTimeout, before the next recusrsive call, previous call is popped off the stack; hence, the stack never fills up completely. Commented Jan 20, 2022 at 14:21

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.