[Tilesathome] Upload queue testing

Matthias Julius lists at julius-net.net
Mon Jul 2 18:34:07 BST 2007


OJW <streetmap at blibbleblobble.co.uk> writes:

> We can reduce the time that "done" tiles remain in the queue, which would 
> achieve that.  However, the API to check whether your requests had been done 
> or not would then only be valid for that time (e.g. 1 hour or whatever). 
> Currently you can check your requests up to 48 hours after they've been 
> finished.

Well, I don't want to change the timeout for "done".

I don't have commit access to SVN so below is a patch.  Simply set
$AveragingInterval to whatever value you like.

This, of course, is untested.

Matthias

--- munin.php   (revision 3452)
+++ munin.php   (working copy)
@@ -14,11 +14,14 @@
   include("../../../connect/connect.php");

   $statuses = array('pending', 'new', 'active', 'done');
-  $Result = mysql_query("select `status`,count(*) as count from `tiles_queue` group by `status` order by `status`;");
+  $AveragingInterval = 1; //for done queue in hours, max. 48
+  $SQL = sprintf("select `status`,count(*) as count from `tiles_queue` where `status` != 3 or `date` > date_sub(now(), INTERVAL '%d' HOUR) group by `status` order by `status`",
+                 $AveragingInterval);
+  $Result = mysql_query($SQL);
   while ($row = mysql_fetch_array($Result)) {
     if ($row['status'] == 3) {
-      // Divide done by 48 as it represents all that have been done in the last 48 hours.
-      printf("done.value %d\n", $row['count']/48);
+      // Divide done by $AveragingInterval as it represents all that have been done in that many hours.
+      printf("done.value %d\n", $row['count']/$AveragingInterval);
     } else {
       printf("%s.value %d\n",
       $statuses[$row['status']],$row['count']);
     }





More information about the Tilesathome mailing list