Answer the question
In order to leave comments, you need to log in
How to check if a node.js script is running?
There is a regular node.js server, I send a request (get) to it from php, authorization in steam is performed there, and after that a number of things I need are performed, BUT, this request occurs every 7 seconds, and it turns out that the attempt will log in to steam 2-3 times, leads to an error, and the server crashes.
How can I check that the script is already running at the moment? Why wouldn't these things happen?
Answer the question
In order to leave comments, you need to log in
Set up a global flag variable inWork , which is true if the script is in progress and false if the work is finished.
If you are logging in every 7 seconds why not think about logging in once and storing the connection id in session, file, database, memcached or somewhere else. On the other hand, you can get rid of the login to the node altogether, you can limit the node to only local requests from 127.0.0.1 from the php script.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question