wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18296: LJSUP-7934. Adding more debug info.

Committer: gprochaev
LJSUP-7934. Adding more debug info.

U   trunk/bin/misc/set_comm_supermaintainer.pl
U   trunk/cgi-bin/communitylib.pl
Modified: trunk/bin/misc/set_comm_supermaintainer.pl
===================================================================
--- trunk/bin/misc/set_comm_supermaintainer.pl	2011-02-14 11:29:54 UTC (rev 18295)
+++ trunk/bin/misc/set_comm_supermaintainer.pl	2011-02-14 12:02:25 UTC (rev 18296)
@@ -88,8 +88,10 @@
 die "Can't fetch communities list\n" unless $communities;
 
 my $i = 0;
-LJ::start_request();
 foreach my $c_id (@$communities) {
+    LJ::start_request();
+    $i++;
+
     _log '-' x 30, "\n";
 
     my $comm = LJ::load_userid ($c_id);
@@ -202,10 +204,6 @@
             }
         }
     } 
-
-    if ($i++ % 20) {
-        LJ::start_request();
-    }
 }
 
 _log '-' x 30, "\n";

Modified: trunk/cgi-bin/communitylib.pl
===================================================================
--- trunk/cgi-bin/communitylib.pl	2011-02-14 11:29:54 UTC (rev 18295)
+++ trunk/cgi-bin/communitylib.pl	2011-02-14 12:02:25 UTC (rev 18296)
@@ -57,14 +57,25 @@
         $poll = LJ::Poll->create (entry => $entry, whovote => 'all', whoview => 'all', questions => \@q)
             or die "Poll was not created";
 
-        $poll->set_prop ('createdate' => $entry->eventtime_mysql)
-            or die "Can't set prop 'createdate'";
+        eval {
+            $poll->set_prop ('createdate' => $entry->eventtime_mysql)
+                or die "Can't set prop 'createdate'";
 
-        $poll->set_prop ('supermaintainer' => $comm->userid)
-            or die "Can't set prop 'supermaintainer'";
+            $poll->set_prop ('supermaintainer' => $comm->userid)
+                or die "Can't set prop 'supermaintainer'";
 
-        _edit_post (to => $to_journal, comm => $comm, entry => $entry, poll => $poll) 
-            or die "Can't edit post";
+            _edit_post (to => $to_journal, comm => $comm, entry => $entry, poll => $poll) 
+                or die "Can't edit post";
+        };
+
+        ## ugly, but reliable
+        if ($@) {
+            print $$textref;
+            use Data::Dumper;
+            warn Dumper($poll);
+            warn Dumper($to_journal);
+            die $@;
+        }
     }
 
     ## All are ok. Emailing to all maintainers about election.

Tags: livejournal, pl, wisest-owl
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