diff scan.pl @ 36:704d76b67670

fixed the island cache problem
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sat, 11 Oct 2008 05:21:06 +0800
parents 51a35c3d057e
children 5849b6fdc76c
line wrap: on
line diff
--- a/scan.pl	Sat Oct 11 05:20:03 2008 +0800
+++ b/scan.pl	Sat Oct 11 05:21:06 2008 +0800
@@ -28,9 +28,13 @@
             Ikariam::Cities->insert($city);
         }
 
-        printf("city %d %s saved\n", $city->{cityId}, $city->{cityname});
+        printf("city %s (%d) at island (%d) saved\n", 
+            $city->{cityname},
+            $city->{cityId}, 
+            $island);
+
         my $user = Ikariam::User->retrieve($city->{user});
-        if(!defined($user) || $user->time le (time - 60*60*12)) {
+        if(!defined($user) || $user->time le (time - 60*60*1)) {
             # Download user profile.
             foreach my $x (qw/score army_score_main trader_score_secondary/)
             {
@@ -99,14 +103,15 @@
     }
 
     # scanning the island
-    if($island->time le (time - 60*60*12 ))
+    if($island->time le (time - 60*60*6))
     {
         my @cities = $i->viewIsland($h_island->{id});
         saveCities($h_island->{id}, @cities);
-    }
 
-    $island->set('time', time);
+        $island->set('time', time);
+    }
     $island->update();
+
 }
 $i->logout;
 # $i->getCityInfo();