refactor: fixes for futures (#3363)

After landing #3358 the benchmarks exploded indicating problems with workers and deno_core_http_bench.

This PR dramatically fixes thread/syscall count that showed up on benchmarks. Thread count is not back to previous levels but difference went from hundreds/thousands to about ~50.
This commit is contained in:
Bartek Iwańczuk 2019-11-17 14:14:50 +01:00 committed by Ry Dahl
parent 2b3afda625
commit f356b2bd5e
5 changed files with 32 additions and 29 deletions

View file

@ -86,14 +86,13 @@ impl WasmCompiler {
let worker_ = worker.clone();
let url = source_file.url.clone();
let _res = worker.post_message(
serde_json::to_string(&base64_data)
.unwrap()
.into_boxed_str()
.into_boxed_bytes(),
);
let fut = worker
.post_message(
serde_json::to_string(&base64_data)
.unwrap()
.into_boxed_str()
.into_boxed_bytes(),
)
.then(move |_| worker)
.then(move |result| {
if let Err(err) = result {
// TODO(ry) Need to forward the error instead of exiting.