madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r21076: LJSUP-11064: loop problem fix, verbose o...

Committer: sbelyaev
LJSUP-11064: loop problem fix, verbose output is added
U   trunk/bin/worker/delayed-entries-poster
U   trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/bin/worker/delayed-entries-poster
===================================================================
--- trunk/bin/worker/delayed-entries-poster	2012-02-02 14:23:54 UTC (rev 21075)
+++ trunk/bin/worker/delayed-entries-poster	2012-02-02 14:34:55 UTC (rev 21076)
@@ -24,7 +24,7 @@
 sub work {
     foreach my $cluster_id (@LJ::CLUSTERS) {
         my $dbr = LJ::DBUtil->get_inactive_db($cluster_id, __PACKAGE__->verbose);
-        LJ::DelayedEntry::Scheduler::on_pulse($cluster_id, $dbr);
+        LJ::DelayedEntry::Scheduler::on_pulse($cluster_id, $dbr, __PACKAGE__->verbose);
     }
 
     return 1 if __PACKAGE__->should_quit;

Modified: trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm	2012-02-02 14:23:54 UTC (rev 21075)
+++ trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm	2012-02-02 14:34:55 UTC (rev 21076)
@@ -56,7 +56,7 @@
 sub __load_delayed_entries {
     my ($dbh) = @_;
     my @entries;
-    
+
     my $list = $dbh->selectall_arrayref("SELECT journalid, delayedid, posterid " .
                                         "FROM delayedlog2 ".
                                         "WHERE posttime <= NOW() LIMIT 1000");
@@ -73,7 +73,7 @@
 sub __send_error {
     my ($poster, $subject, $error) = @_;
     my $email = $poster->email_raw;
-    
+
     LJ::send_mail({
         'to'        => $email,
         'from'      => $LJ::ADMIN_EMAIL,
@@ -89,7 +89,7 @@
 
 
 sub on_pulse {
-    my ($clusterid, $dbh) = @_;
+    my ($clusterid, $dbh, $verbose) = @_;
     __assert($dbh);
 
     my $lock = new LJ::DelayedEntry::Scheduler::TableLock($dbh);
@@ -102,14 +102,33 @@
         while ( my $entries = __load_delayed_entries($dbh) ) {
             foreach my $entry (@$entries) {
                 my $post_status = $entry->convert();
-        
+
                 # do we need to send error
                 if ( $post_status->{error_message} ) {
                     __send_error($entry->poster, 
                                 $entry->data->{subject},
                                 $post_status->{error_message});
+
+                    if ($verbose) {
+                        print "(posting failed)The entry with subject " . $entry->subject;
+                        print "\ndelayed id = " . $entry->delayedid . 
+                        print " and post date " . $entry->posttime . "\n";
+                    }
+                } elsif ($verbose) {
+                        print "(posting)The entry with subject " . $entry->subject;
+                        print "\ndelayed id = " . $entry->delayedid . 
+                        print " and post date " . $entry->posttime . "\n";
                 }
+
                 if ( $post_status->{delete_entry} ) {
+
+                    if ($verbose) {
+                        print "The entry with subject " . $entry->subject;
+                        print "\ndelayed id = " . $entry->delayedid . 
+                        print " and post date " . $entry->posttime;
+                        print " is deleted\n";
+                    }
+
                     $entry->delete();
                 }
             }

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-02-02 14:23:54 UTC (rev 21075)
+++ trunk/cgi-bin/ljprotocol.pl	2012-02-02 14:34:55 UTC (rev 21076)
@@ -2366,6 +2366,7 @@
             $req->{ext}->{flags} = $flags;
             $req->{ext}->{flags}->{u} = undef; # it's no need to be stored
             $req->{usejournal} = $req->{usejournal} || '';
+            delete $req->{'custom_time'};
   
             my $entry = LJ::DelayedEntry->create( $req, { journal => $uowner,
                                                           poster  => $u,} );

Tags: livejournal, madeon, pl, pm, sbelyaev
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