derekovecs: compute reference collocates in parallel
diff --git a/w2v-server.pl b/w2v-server.pl
index 0873562..527c7ce 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -119,6 +119,9 @@
$word-=$mergedEnd;
}
+ if($opt_p >= 5000 && $opt_p < 5600) { # German non-reference
+ open PIPE, "GET http://compute:5673/getClassicCollocators?w=$word |" ;
+ }
if(!$cccache{$word}) {
$c->app->log->info("Getting classic collocates of $word.");
$cccache{$word} = getClassicCollocators($word);
@@ -126,8 +129,12 @@
$c->app->log->info("Getting classic collocates for $word from cache.");
}
if($opt_p >= 5000 && $opt_p < 5600) { # German non-reference
- $s2 = `GET http://compute:5673/getClassicCollocators?w=$word`;
+ while(<PIPE>) {
+ $s2 .= $_;
+ }
+ close(PIPE);
}
+
if(length($s2) > 2000) {
my $d1 = decode_json($cccache{$word});
my $d2 = decode_json($s2);