Permalink
Browse files

Bug 816934 - Clobberer page for mozilla-inbound timing out when clobb…

…ering all platforms. r=rail
  • Loading branch information...
1 parent d49d4f4 commit 1566a462ea850354197a527e1b321f377ece34b3 @jhopkinsmoz jhopkinsmoz committed Dec 5, 2012
Showing with 19 additions and 3 deletions.
  1. +19 −3 clobberer/index.php
View
@@ -46,18 +46,27 @@ function isSpecial($user)
return in_array($user, $SPECIAL_PEOPLE);
}
+$canSeeCache = array();
function canSee($builddir, $user)
{
+ global $canSeeCache;
+ $key = $builddir . '|' . $user;
+ if (array_key_exists($key, $canSeeCache)) {
+ return $canSeeCache[$key];
+ }
+
$builders = array();
foreach (getReleaseBuilders() as $builder) {
$builders[] = $builder['builddir'];
}
global $RELEASE_PREFIX;
if (!in_array($builddir, $builders) && strpos($builddir, $RELEASE_PREFIX)!==0) {
- return true;
+ $canSeeCache[$key] = true;
}
-
- return isSpecial($user);
+ else {
+ $canSeeCache[$key] = isSpecial($user);
+ }
+ return $canSeeCache[$key];
}
function b64_encode($s)
@@ -89,8 +98,14 @@ function getBuilders($slave)
return $retval;
}
+$getReleaseBuildersCache = array();
function getReleaseBuilders()
{
+ global $getReleaseBuildersCache;
+ $key = "$RELEASE_PREFIX%";
+ if (array_key_exists($key, $getReleaseBuildersCache)) {
+ return $getReleaseBuildersCache[$key];
+ }
global $dbh;
global $RELEASE_PREFIX;
$ret = array();
@@ -103,6 +118,7 @@ function getReleaseBuilders()
);
$ret[] = $r;
}
+ $getReleaseBuildersCache[$key] = $ret;
return $ret;
}

0 comments on commit 1566a46

Please sign in to comment.