At the very least, I imagine you could improve this a few ways.
1. Spawn a single process/daemonize it.
2. Wake up and check at least once every second (or whatever the preferred timing is).
3. Don't blindly read the JSON every time (check the last modified time before reading the contents). Obviously if it hasn't been modified, then go back to sleep (perhaps shorten the sleep window if time is of the essence).
4. I don't imagine you can guarantee a process finished writing the file before you finish reading the file... so maybe this belongs in a database.
1. Spawn a single process/daemonize it.
2. Wake up and check at least once every second (or whatever the preferred timing is).
3. Don't blindly read the JSON every time (check the last modified time before reading the contents). Obviously if it hasn't been modified, then go back to sleep (perhaps shorten the sleep window if time is of the essence).
4. I don't imagine you can guarantee a process finished writing the file before you finish reading the file... so maybe this belongs in a database.