--- usernode.module.orig	2007-03-24 03:54:37.984375000 -0400
+++ usernode.module	2007-03-24 04:12:15.796875000 -0400
@@ -27,6 +27,12 @@ function usernode_node_info() {
   );
 }
 
+function usernode_cron() {
+  if (variable_get('usernode_check_more', 0)) {
+    usernode_check_all();
+  }
+}
+
 /**
  * Implementation of hook_form(): Construct the usernode form.
  */
@@ -368,13 +374,15 @@ function is_usernode($node, $account = N
  */
 function usernode_enable() {
   // if the module is activated, we recheck the usernodes
-  usernode_check_all();
+  if (usernode_check_all()) {
+    variable_set('usernode_check_more', 1);
+  }
 }
 
 /**
  * Check all users for an existing usernode, and create one if necessary.
  */
-function usernode_check_all() {
+function usernode_check_all($limit = 100) {
   // find usernodes that have been deleted while the module was deactivated
   $result = db_query("SELECT un.* FROM {usernode} un ".
                      "LEFT JOIN {node} n ON un.nid = n.nid ".
@@ -387,11 +395,17 @@ function usernode_check_all() {
   // create usernodes for all existing users without a usernode
   $result = db_query("SELECT u.* FROM {users} u ".
                      "LEFT JOIN {usernode} un ON u.uid = un.uid ".
-                     "WHERE un.nid IS NULL AND u.uid != 0");
+                     "WHERE un.nid IS NULL AND u.uid != 0 LIMIT %d", $limit);
 
   while ($user = db_fetch_object($result)) {
     usernode_create_node($user);
+    $processed ++;
+  }
+  if ($processed < $limit) {
+    variable_del('usernode_check_more');
+    return 0;
   }
+  return 1;
 }
 
 /**
