This is a basic problem with doing any automated task in reaction to other people's behavior or network splits. You may have to reconcile that you do not really need to /whois everyone, or perhaps you can perform delayed batch processing of /whois lookups and only do them for new strangers who really need it... adding known regular users to an exemption list.

Another solution is to just temporarily disable the script, ignoring when there are too many joins in a short period like after a netsplit resync.

Why do you feel it's necessary to /whois everyone, and can the same information be gleaned by other means?


Well. At least I won lunch.
Good philosophy, see good in bad, I like!