Index: trunk/pstamp/scripts/pstamp_queue_requests.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_queue_requests.pl	(revision 19265)
+++ trunk/pstamp/scripts/pstamp_queue_requests.pl	(revision 21410)
@@ -107,7 +107,17 @@
         my $command = "$dsproductls --uri $ds->{uri}/index.txt";
         $command .= " --last_fileset $ds->{lastFileset}" if $ds->{lastFileset};
+
         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
             run(command => $command, verbose => $verbose);
         unless ($success) {
+            # dsproductls exit status is the http error code - 300
+            my $exit_status = $error_code >> 8;
+
+            # don't die on "common faults"
+            # perhaps after some number of these we should mark the data store as disabled
+            next if ($exit_status == 200);  # 500 cannot connect (data store down)
+            next if ($exit_status == 104);  # 404 not found
+#            next if ($exit_status == 100);  # 400 bad request
+
             die("Unable to perform $command: $error_code");
         }
@@ -143,4 +153,6 @@
                     run(command => $command, verbose => $verbose);
             unless ($success) {
+                # we don't want to die here. We need to set lastFileset
+                # so that we don't re queue requsts that we have proccessed
                 die("Unable to perform $command: $error_code");
             }
@@ -175,14 +187,7 @@
         }
         $lastFileset = $fs_name;
-        last if ($numFilesets >= $limit);
-    }
-
-    ## now update the last_fileset column in pstampDataStore
-    ## XXX: we should perhaps do this while processing each fileset so that if a later
-    ## one has an error we don't get repeats.
-
-    if ($lastFileset) {
-        # print "last fileset: $lastFileset\n";
+
         {
+        ## now update the last_fileset column in pstampDataStore
         my $command = "$pstamptool -ds_id $ds_id -moddatastore -last_fileset $lastFileset";
         $command .= " -dbname $dbname" if $dbname;
@@ -193,4 +198,5 @@
             }
         }
+        last if ($numFilesets >= $limit);
     }
 }
