Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[ljcom] r9620: LJSUP-7147: Twitter worker improvements:...

Committer: gariev
LJSUP-7147: Twitter worker improvements: 1) more debug info, 2) decreased sleep time in case of Twitter server error

U   trunk/bin/worker/twitter-digest
Modified: trunk/bin/worker/twitter-digest
===================================================================
--- trunk/bin/worker/twitter-digest	2010-10-14 05:24:06 UTC (rev 9619)
+++ trunk/bin/worker/twitter-digest	2010-10-14 08:07:59 UTC (rev 9620)
@@ -16,14 +16,20 @@
 use LJ::TwitterDigest;
 
 sub work {
+    my $verbose = LJ::NewWorker->verbose;
     my $u = LJ::TwitterDigest->get_pending_user;
 
-    # in case there is no user, we can sleep
-    return 0 unless defined $u;
+    unless (defined $u) {
+        # in case there is no user, we can sleep
+        warn "No user found" if $verbose;
+        return 0;
+    }
 
+    warn "Processing user $u->{user}" if $verbose;
+
     my $res = LJ::TwitterDigest->post_digest($u);
 
-    if ($LJ::IS_DEV_SERVER) {
+    if ($verbose) {
         if ($res) {
             warn "digest has been posted: $res->{url}\n";
         } else {
@@ -43,7 +49,7 @@
         exit;
     }
 
-    sleep 1800;
+    sleep 60;
 }
 
 1;

Tags: gariev, ljcom
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