Skip to content

Commit

Permalink
Need to do some stupid stuff to workaround rediculous unreproducable …
Browse files Browse the repository at this point in the history
…graphviz bug that makes me cry where sometimes no company images are inserted into svg??????git diff generateCache.phpgit diff generateCache.php
  • Loading branch information
michalgm committed Dec 13, 2013
1 parent f98ef0e commit 8c65780
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions backend/generateCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function cache_races() {
global $nodeViz_config;

if ($force && $nodeViz_config['cache_path']) {
system("rm -rf $nodeViz_config[cache_path]/*;");
print "deleting old cache\n";
system("rm -rf $nodeViz_config[cache_path]/*");
}
$_REQUEST = array('candidateLimit' => 250, 'companyLimit'=>250, 'graphWidth'=>600, 'graphHeight'=>600);
$count = (((($max_cycle - $min_cycle) /2)+2) *3 * (count($states)));
Expand All @@ -63,20 +64,31 @@ function cache_races() {
$_REQUEST['cycle'] = $min_cycle;
while ($_REQUEST['cycle'] <= $max_cycle) {
$x = showProgress($x, $count);
fork_work('graph', 'StateDEM');
cache_race();
$_REQUEST['cycle'] += 2;
}
}
if ($_REQUEST['chamber'] != 'state:all') {
$_REQUEST['cycle'] = 'all';
$x = showProgress($x, $count);
fork_work('graph', 'StateDEM');
cache_race();
}
}
}
print "\n";
}

function cache_race() {
global $_REQUEST;
$success = 0;
while (! $success) {
$graph = buildCache('StateDEM');
$name = $graph->data['name'];
$file = file_get_contents("../cache/$name/$name.svg");
$success = preg_match("/com_image/", $file);
}
}

function cache_candidates() {
echo "caching candidates;\n";
global $_REQUEST;
Expand Down

0 comments on commit 8c65780

Please sign in to comment.