Node.js crashes when using long interval in setinterval

眉间皱痕 提交于 2019-11-29 01:02:58

Instead of calling the Function Directly give it inside a callback.

function createSasTokenTimer() {    
  console.log("Hello");
}

setInterval(function(){
 createSasTokenTimer();
}, 3000000);

Using this method, you are passing an anonymous function to setInterval. It will call this function once per interval, which is 3000000 miliseconds in this example.

For now, you can probably just use this code. For further understanding, I suggest researching anonymous functions and closures.

Hope this helps.

To me this looks like a non standard modual that you are using instead of the native modual. Look at global.process.moduleLoadList it should have the entries

 'NativeModule timers',
 'Binding timer_wrap',

And check your code that you are not importing 3rd party timers.js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!