I'm wondering if there is any real reason to use a loop like this?
There must be one while loop that lasts till the end of EB timeframe.
Without it script will run to the end and exit.

Of course you can try different implementations of 4tpy script but you will still end up with while loop that is running all the time.

I dont remember if we used this script from the beginning but I remember that there was no significant ( relative to current EB slowness ) slowdowns.
It just grew over the time as we where adding more and more scripts.