I need to run a job every second in node.js. First I tried to use setInterval, then I tried later.js https://www.npmjs.com/package/later
But when I try to run my job with both of these ways, I have the same problem: there is a lag in about 2-3 milliseconds.
I placed console.log(new Date()) in my job and it shows that every next calling of my job happens 2-3 milliseconds later than the previous one.
What is the best and precise way of running a job every second in node.js?