Change poll inrterval to 3 seconds. There is no reason to poll every second.
Remove latest parity check files on the next poll after the parity history is updated. I believe there was a race condition here with the 'monitor' task that sends the notify message. It was picking up the previous parity history entry and not the current parity check.
Change 'file_put_contents()' to 'file_put_contents_atomic()' wrapper. Cannot do this for a file_put_contents file append though.