Index: plugins/FeedsUserProcessor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsUserProcessor.inc,v
retrieving revision 1.10
diff -u -p -r1.10 FeedsUserProcessor.inc
--- plugins/FeedsUserProcessor.inc	28 Apr 2010 22:18:30 -0000	1.10
+++ plugins/FeedsUserProcessor.inc	2 Jun 2010 19:36:31 -0000
@@ -6,6 +6,9 @@
  * FeedsUserProcessor class.
  */
 
+// Create or delete FEEDS_USER_BATCH_SIZE at a time.
+define('FEEDS_USER_BATCH_SIZE', 50);
+
 /**
  * Feeds processor plugin. Create users from feed items.
  */
@@ -16,8 +19,8 @@ class FeedsUserProcessor extends FeedsPr
    */
   public function process(FeedsImportBatch $batch, FeedsSource $source) {
 
-    // Count number of created and updated nodes.
-    $created  = $updated = $failed = 0;
+    // Count number of processed.
+    $processed = 0;
 
     while ($item = $batch->shiftItem()) {
 
@@ -28,7 +31,12 @@ class FeedsUserProcessor extends FeedsPr
 
         // Check if user name and mail are set, otherwise continue.
         if (empty($account->name) || empty($account->mail) || !valid_email_address($account->mail)) {
-          $failed++;
+          $batch->failed++;
+          $processed++;
+
+          if ($processed >= variable_get('feeds_user_batch_size', FEEDS_USER_BATCH_SIZE)) {
+            return (1.0 / ($batch->total + 1)) * ($batch->updated + $batch->created); // Add + 1 to make sure that result is not 1.0 = finished.
+          }
           continue;
         }
 
@@ -51,31 +59,36 @@ class FeedsUserProcessor extends FeedsPr
         }
 
         if ($uid) {
-          $updated++;
+          $batch->updated++;
         }
         else {
-          $created++;
+          $batch->created++;
+        }
+
+        $processed++;
+        if ($processed >= variable_get('feeds_user_batch_size', FEEDS_USER_BATCH_SIZE)) {
+          return (1.0 / ($batch->total + 1)) * ($batch->updated + $batch->created); // Add + 1 to make sure that result is not 1.0 = finished.
         }
       }
     }
 
     // Set messages.
-    if ($failed) {
+    if ($batch->failed) {
       drupal_set_message(
         format_plural(
-          $failed,
+          $batch->failed,
           'There was @number user that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.',
           'There were @number users that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.',
-          array('@number' => $failed)
+          array('@number' => $batch->failed)
         ),
         'error'
       );
     }
-    if ($created) {
-      drupal_set_message(format_plural($created, 'Created @number user.', 'Created @number users.', array('@number' => $created)));
+    if ($batch->created) {
+      drupal_set_message(format_plural($batch->created, 'Created @number user.', 'Created @number users.', array('@number' => $batch->created)));
     }
-    elseif ($updated) {
-      drupal_set_message(format_plural($updated, 'Updated @number user.', 'Updated @number users.', array('@number' => $updated)));
+    elseif ($batch->updated) {
+      drupal_set_message(format_plural($batch->updated, 'Updated @number user.', 'Updated @number users.', array('@number' => $batch->updated)));
     }
     else {
       drupal_set_message(t('There are no new users.'));
