+ /*
+ * multiple processes on multiple web servers can run this code concurrently
+ * try to make this as atomic as possible by setting doing_cron switch
+ */
+ $flag = get_transient('doing_cron');
+
+ if ( $flag > $local_time + 10*60 )
+ $flag = 0;
+
+ // don't run if another process is currently running it or more than once every 60 sec.
+ if ( $flag + 60 > $local_time )
+ return;
+