mirror of https://github.com/BOINC/boinc.git
BOINC web: fix bug in get_platforms()
There was a logic error that would cause every load of the project page to initiate a web request to GPUgrid. When GPUgrid was down, this could create lots of sockets, which eventually would prevent incoming connections. I think this is the reason for the sporadic slowdowns of the BOINC web site.
This commit is contained in:
parent
3f0f36ac5a
commit
050c347f31
|
@ -281,22 +281,21 @@ function get_platforms_cached($url) {
|
||||||
$u = urlencode($url);
|
$u = urlencode($url);
|
||||||
$fname = "/home/boincadm/boinc/doc/platforms/$u";
|
$fname = "/home/boincadm/boinc/doc/platforms/$u";
|
||||||
$t = @filemtime($fname);
|
$t = @filemtime($fname);
|
||||||
if (!strstr($url, "gpugrid") && $t && $t > time() - 604800) {
|
if (strstr($url, "gpugrid") || ($t && $t > time() - 604800)) {
|
||||||
$l = json_decode(file_get_contents($fname));
|
return json_decode(file_get_contents($fname));
|
||||||
|
}
|
||||||
|
$l = get_platforms($url);
|
||||||
|
if (!$l) {
|
||||||
|
$l = get_platforms2($url);
|
||||||
|
}
|
||||||
|
if ($l) {
|
||||||
|
file_put_contents($fname, json_encode($l));
|
||||||
} else {
|
} else {
|
||||||
$l = get_platforms($url);
|
if (file_exists($fname)) {
|
||||||
if (!$l) {
|
touch($fname);
|
||||||
$l = get_platforms2($url);
|
|
||||||
}
|
|
||||||
if ($l) {
|
|
||||||
file_put_contents($fname, json_encode($l));
|
|
||||||
} else {
|
} else {
|
||||||
if (file_exists($fname)) {
|
$l[] = "Unknown";
|
||||||
touch($fname);
|
file_put_contents($fname, json_encode($l));
|
||||||
} else {
|
|
||||||
$l[] = "Unknown";
|
|
||||||
file_put_contents($fname, json_encode($l));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $l;
|
return $l;
|
||||||
|
|
Loading…
Reference in New Issue