setTimeout in nodeJS
deexter

deexter @deexter

Joined:
Aug 31, 2020

setTimeout in nodeJS

Publish Date: Aug 31 '20
1 0

We recently started with building new messaging service, that should be made with request reply pattern.

We had no much experience how nodeJS works so we struggled with setting timeout.
Initialy we thought this should work
Alt Text
If you will write code like us you will never get out of while loop, because setTimeout will never be executed.

It is caused because nodeJs has event loop and you have to pass context
Alt Text

Have you ever struggled with same problem?
Share your ideas.

Comments 0 total

    Add comment