I have no idea how this can happen and how a script can affect the replication lag while it does nothing than sleeping.
By holding a lock. I don't know if this is the case here, but it would be an explanation. Are you using explicit transactions?
But I will not start it again - then there are just no statistic updates anymore.
Please tell me what queries exactly the script performs. I'm pretty sure this could be done more efficiently somehow - for example, by using at the recentchanges table instead of revisions.
BTW, the lag raises very often even if this scripts does'nt run ..
Every time the replag rises like this, we find a script that's causing it. It's not always yours, sure, but it has been before.
Don't think we just want to blame you - your efforts are appreciated. The toolserver is just at its limits right now (we *still* don't have the fast disk online - this is really annoying). We have to cope somehow.
Regards Daniel