Node.JS中可以同时运行的setTimeout()方法的最大数量是多少

I have a java script file which runs using nodeJS. I am using the setTimeout() method to create a sort of timer which will run some code after a user specified time. As multiple users will be using this code will there be a problem with running lets say 1000 setTimeout methods in parallel? Is there a maximum number that can run simultaneously or will it just make the program run slower the more I have?

评论
  • liste
    liste 回复

    There is no hard limit to how many setTimeouts you can have at once, it'll just use more memory the more you have, but if you have a lot and exact timing isn't important you may just want to load the events into an array and have a single setInterval going through the array and running them if the timeout finished.