sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[ljcom] r11370: LJSUP-10937: Workers and locks fixes

Committer: vtroitsky
LJSUP-10937: Workers and locks fixes
U   trunk/bin/maint/selfpromo.pl
U   trunk/cgi-bin/LJ/Pay/SelfPromo.pm
Modified: trunk/bin/maint/selfpromo.pl
===================================================================
--- trunk/bin/maint/selfpromo.pl	2012-01-31 06:15:04 UTC (rev 11369)
+++ trunk/bin/maint/selfpromo.pl	2012-01-31 07:12:42 UTC (rev 11370)
@@ -8,6 +8,8 @@
 
 $maint{'selfpromo_check'} = sub {
     LJ::Pay::SelfPromo::EntryPromo->check_current_promo;
+    LJ::Pay::SelfPromo::JournalPromo->check_current_promo;
+    LJ::Pay::SelfPromo::CommunityPromo->check_current_promo;
 };
 
 1;

Modified: trunk/cgi-bin/LJ/Pay/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2012-01-31 06:15:04 UTC (rev 11369)
+++ trunk/cgi-bin/LJ/Pay/SelfPromo.pm	2012-01-31 07:12:42 UTC (rev 11370)
@@ -1245,8 +1245,7 @@
         return;
     }
 
-    my $lock_result =
-        LJ::get_lock( LJ::get_db_writer(), 'global', $name );
+    my $lock_result = LJ::get_lock( LJ::get_db_writer(), 'global', $name );
 
     unless ($lock_result) {
         LJ::Pay::SelfPromo->debug_msg(
@@ -1270,9 +1269,9 @@
     ## if original exception ($@) is not saved, it will be lost.
     local $@;
 
-    LJ::release_lock( LJ::get_db_writer(), 'global', $locked ) unless ($locked eq '');
-
-    $LJ::REQ_GLOBAL{'selfpromo_locked'} = 0;
+    LJ::release_lock( LJ::get_db_writer(), 'global', $locked ) unless $locked eq '';
+    $LJ::REQ_GLOBAL{$locked} = 0;
+    $locked = '';
 }
 
 sub taken {
@@ -1285,7 +1284,6 @@
 
 sub taken_elsewhere {
     my ($class, @names) = @_;
-
     my $result = ! $locked && $class->taken(@names);
     LJ::Pay::SelfPromo->debug_msg("lock taken elsewhere => $result");
     return $result;

Tags: ljcom, pl, pm, sunnyman, vtroitsky
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