madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20246: LJSUP-10039: update worker and convert f...

Committer: sbelyaev
LJSUP-10039: update worker and convert function
U   trunk/bin/worker/delayed-entries-poster
U   trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm
U   trunk/cgi-bin/LJ/DelayedEntry.pm
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/bin/worker/delayed-entries-poster
===================================================================
--- trunk/bin/worker/delayed-entries-poster	2011-10-07 07:50:38 UTC (rev 20245)
+++ trunk/bin/worker/delayed-entries-poster	2011-10-07 07:52:26 UTC (rev 20246)
@@ -2,14 +2,12 @@
 use lib "$ENV{LJHOME}/cgi-bin";
 LJ::NewWorker::Manual::DelayedEntriesPoster->start();
 
-package LJ::NewWorker::Manual::DelayedEntriesPoster ;
-
-
+package LJ::NewWorker::Manual::DelayedEntriesPoster;
 use strict;
 use warnings;
+
 use lib "$ENV{LJHOME}/cgi-bin";
 use base 'LJ::NewWorker::Manual';
-
 require 'ljlib.pl';
 require 'ljdb.pl';
 
@@ -20,7 +18,7 @@
 sub options {
     my $self = shift;
     return (
-        'cluster|c=i'  => \$cluster,
+        'cluster=i'  => \$cluster,
         $self->SUPER::options(),
     );
 }
@@ -43,5 +41,9 @@
 
 sub on_idle {
     sleep LJ::DelayedEntry::Scheduler::pulse_time();
-;
 }
+
+__PACKAGE__->start() unless caller;
+
+1;
+

Modified: trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm	2011-10-07 07:50:38 UTC (rev 20245)
+++ trunk/cgi-bin/LJ/DelayedEntry/Scheduler.pm	2011-10-07 07:52:26 UTC (rev 20246)
@@ -25,12 +25,10 @@
                                                    { journalid  => $tuple->[0],
                                                      delayed_id => $tuple->[1],
                                                      posterid   => $tuple->[2]} );
-       
     }
     return \@entries;
 }
 
-
 sub __send_error {
     my ($poster, $subject, $error) = @_;
     my $email = $poster->email_raw;
@@ -48,15 +46,14 @@
     });    
 }
 
-
 sub on_pulse {
     my ($clusterid, $dbh) = @_;
     __assert($dbh);
-
     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, 
@@ -68,10 +65,8 @@
             $entry->delete();
         }
     }
-    
 }
 
-
 sub __assert() {
     my ($statement) = @_;
     unless ($statement) {

Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-07 07:50:38 UTC (rev 20245)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2011-10-07 07:52:26 UTC (rev 20246)
@@ -1151,7 +1151,7 @@
 
     my $flags     = $ext->{flags};
     my $event     = $req->{event};
-    my $eventtime = __get_datatime($req);
+    my $eventtime = __get_datatime($req, 'NO_TIMEZONE');
 
     my $security  = "public";
     my $uselogsec = 0;
@@ -1588,7 +1588,7 @@
 }
 
 sub __get_datatime {
-    my ($req) = @_;
+    my ($req, $dont_use_tz) = @_;
     __assert($req);
     __assert($req->{'tz'});
 
@@ -1601,12 +1601,10 @@
         time_zone => $req->{tz},
     );
 
-    #if ($dt->is_dst) {
-    #    $dt->subtract( hours => 1 );
-    #}
+    if (!$dont_use_tz) {
+        $dt->set_time_zone( 'UTC' );
+    }
 
-    $dt->set_time_zone( 'UTC' );
-
     # make the proper date format
     return sprintf("%04d-%02d-%02d %02d:%02d",  $dt->year, 
                                                 $dt->month,

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2011-10-07 07:50:38 UTC (rev 20245)
+++ trunk/cgi-bin/ljprotocol.pl	2011-10-07 07:52:26 UTC (rev 20246)
@@ -2639,8 +2639,9 @@
                 return $res;
             }
 
+
+            $entry->update($req);
             if ( LJ::DelayedEntry::is_future_date($req) ) {
-                $entry->update($req);
                 $res->{type} = 'delayed';
             } else {
                 my $out = $entry->convert;

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