0
Under review

8x JS scripts crashing iRidium Server on Raspberry Pi

Iain Brew 4 years ago in Bugs and problems updated by Vladimir Ovchinnikov (expert) 4 years ago 2

I have an iRidium Server project which connects to 4x Global Cache IP2SL connected to Extron SMP111 video recording devices. I have two scripts - one to query the recording timecode every second and the other to query the recording state (initialising, recording, pause, stopping). In total there are 8x scripts querying every 1000ms. This works well but after a few minutes the server locks up and restarts. I am guessing it's due to 8 simultaneously commands happening, or perhaps because i'm getting two feedbacks from one driver simultaneously. 

One thought to solve this is to stagger the reqesust i.e. have one requesting every 500ms, the other at 501ms so that the there is only one response coming in at a time from one driver (or potentially staggering all so that there is only one feedback at any one time). 

Is there more a clever way of doing this?

My terrible attempt at JavaScript > here 

Under review

Hello.

SetInterval does not track the execution of the previous function call and is triggered at the intervals specified. Therefore, a new function call in Setinterval can start even if the previous function call has not finished yet. If you need to send specific commands every second, use recursive SetTimeout instead of SetInterval. This allows you to wait for the function to execute before calling the function again.