vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r10460: LJSUP-8573: One error in a recbill proce...

Committer: vsukhanov
LJSUP-8573: One error in a recbill processing can stop the whole queue.
U   trunk/bin/maint/expiring.pl
Modified: trunk/bin/maint/expiring.pl
===================================================================
--- trunk/bin/maint/expiring.pl	2011-04-28 05:55:49 UTC (rev 10459)
+++ trunk/bin/maint/expiring.pl	2011-04-28 09:01:51 UTC (rev 10460)
@@ -61,7 +61,7 @@
     my %users_noexp = (); # uid => 1
     my $emailerr = sub {
         my ($u, $err) = @_;
-        LJ::send_mail({ 'to' => 'hlyne@livejournalinc.com,ops@livejournalinc.com,arie@livejournalinc.com',
+        LJ::send_mail({ 'to' => 'ops@livejournalinc.com,arie@livejournalinc.com',
                         'from' => $LJ::BOGUS_EMAIL,
                         'wrap' => 1,
                         'charset' => 'utf-8',
@@ -89,7 +89,7 @@
         my $unlock = sub { LJ::Pay::release_lock($u); return 1; };
 
         my $next   = sub { $unlock->() && next ACCOUNT  };
-        my $die    = sub { $unlock->() && $emailerr->($u, $@) && die $@ };
+        my $die    = sub { $unlock->() && $emailerr->($u, $@) && next ACCOUNT };
 
         my $rec = LJ::Pay::RecBill->load( u => $u )
             or $die->();
@@ -98,7 +98,7 @@
 
         # is there anything to be done at this time?
         {
-            my $rv = $rec->should_renew;
+            my $rv = eval { $rec->should_renew };
             print "user=$u->{user}, should_renew=" . ($rv+0) . "\n";
             $die->() unless defined $rv;
 
@@ -115,10 +115,22 @@
         # extend the user's account as necessary
         {
             my $retry_flag = undef;
-            my $rv = $rec->extend_account(\$retry_flag);
+            my $rv = eval { $rec->extend_account(\$retry_flag) };
 
             unless ($rv) {
 
+                if ($@ =~ /unable to find Profile ID/){
+                    ## User does not have Cybersource Profile ID.
+
+                    ## LJSUP-8573:
+                    ##
+                    ## When this happens, the script should autodetect and remove the person from the table and continue on, 
+                    ## the error is very distinctive: should_renew=1error sending account capture request: unable to find Profile ID
+                    $dbh->do("delete from recbill where userid=?", undef, $userid);
+                    $rec->log_statushistory("removed due to should_renew=1error sending account capture request: unable to find Profile ID");
+                    $next->();
+                }
+
                 $rec->log_statushistory("Serious error extending user account. Aborting.");
 
                 # otherwise, a more serious error occurred, we should

Tags: ljcom, pl, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments