diff --git a/Cargo.lock b/Cargo.lock index 8e655c4d6b5..505a7859189 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -839,7 +839,7 @@ dependencies = [ [[package]] name = "graph" -version = "0.10.0" +version = "0.11.0" dependencies = [ "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "bigdecimal 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -875,14 +875,14 @@ dependencies = [ [[package]] name = "graph-core" -version = "0.10.0" +version = "0.11.0" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", - "graph-graphql 0.10.0", - "graph-mock 0.10.0", - "graph-runtime-wasm 0.10.0", + "graph 0.11.0", + "graph-graphql 0.11.0", + "graph-mock 0.11.0", + "graph-runtime-wasm 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "ipfs-api 0.5.1 (git+https://github.com/ferristseng/rust-ipfs-api)", @@ -900,21 +900,21 @@ dependencies = [ [[package]] name = "graph-datasource-ethereum" -version = "0.10.0" +version = "0.11.0" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", + "graph 0.11.0", "jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "graph-graphql" -version = "0.10.0" +version = "0.11.0" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", + "graph 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -925,19 +925,19 @@ dependencies = [ [[package]] name = "graph-mock" -version = "0.10.0" +version = "0.11.0" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", - "graph-graphql 0.10.0", + "graph 0.11.0", + "graph-graphql 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "graph-node" -version = "0.10.0" +version = "0.11.0" dependencies = [ "assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -945,15 +945,15 @@ dependencies = [ "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "git-testament 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", - "graph-core 0.10.0", - "graph-datasource-ethereum 0.10.0", - "graph-mock 0.10.0", - "graph-runtime-wasm 0.10.0", - "graph-server-http 0.10.0", - "graph-server-json-rpc 0.10.0", - "graph-server-websocket 0.10.0", - "graph-store-postgres 0.10.0", + "graph 0.11.0", + "graph-core 0.11.0", + "graph-datasource-ethereum 0.11.0", + "graph-mock 0.11.0", + "graph-runtime-wasm 0.11.0", + "graph-server-http 0.11.0", + "graph-server-json-rpc 0.11.0", + "graph-server-websocket 0.11.0", + "graph-store-postgres 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "ipfs-api 0.5.1 (git+https://github.com/ferristseng/rust-ipfs-api)", @@ -965,7 +965,7 @@ dependencies = [ [[package]] name = "graph-runtime-derive" -version = "0.10.0" +version = "0.11.0" dependencies = [ "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -973,14 +973,14 @@ dependencies = [ [[package]] name = "graph-runtime-wasm" -version = "0.10.0" +version = "0.11.0" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 6.1.0 (git+https://github.com/graphprotocol/ethabi.git?branch=graph-patches)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", - "graph-mock 0.10.0", - "graph-runtime-derive 0.10.0", + "graph 0.11.0", + "graph-mock 0.11.0", + "graph-runtime-derive 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "ipfs-api 0.5.1 (git+https://github.com/ferristseng/rust-ipfs-api)", @@ -993,12 +993,12 @@ dependencies = [ [[package]] name = "graph-server-http" -version = "0.10.0" +version = "0.11.0" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", - "graph-graphql 0.10.0", - "graph-mock 0.10.0", + "graph 0.11.0", + "graph-graphql 0.11.0", + "graph-mock 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1008,9 +1008,9 @@ dependencies = [ [[package]] name = "graph-server-json-rpc" -version = "0.10.0" +version = "0.11.0" dependencies = [ - "graph 0.10.0", + "graph 0.11.0", "jsonrpc-http-server 10.1.0 (git+https://github.com/paritytech/jsonrpc)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1018,11 +1018,11 @@ dependencies = [ [[package]] name = "graph-server-websocket" -version = "0.10.0" +version = "0.11.0" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", - "graph-graphql 0.10.0", + "graph 0.11.0", + "graph-graphql 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.24 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1033,7 +1033,7 @@ dependencies = [ [[package]] name = "graph-store-postgres" -version = "0.10.0" +version = "0.11.0" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "diesel 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1042,8 +1042,8 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "fallible-iterator 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "graph 0.10.0", - "graph-graphql 0.10.0", + "graph 0.11.0", + "graph-graphql 0.11.0", "graphql-parser 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2576,8 +2576,8 @@ dependencies = [ name = "test-store" version = "0.1.0" dependencies = [ - "graph 0.10.0", - "graph-store-postgres 0.10.0", + "graph 0.11.0", + "graph-store-postgres 0.11.0", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/runtime/wasm/src/host.rs b/runtime/wasm/src/host.rs index 04ad78fc542..ce2be07ee08 100644 --- a/runtime/wasm/src/host.rs +++ b/runtime/wasm/src/host.rs @@ -86,7 +86,7 @@ where } } -type MappingResponse = Result; +type MappingResponse = (Result, futures::Finished); #[derive(Debug)] struct MappingRequest { @@ -275,7 +275,7 @@ impl RuntimeHost { }; result_sender - .send(result) + .send((result, future::ok(Instant::now()))) .map_err(|_| err_msg("WASM module result receiver dropped.")) }) .wait() @@ -610,14 +610,12 @@ impl RuntimeHostTrait for RuntimeHost { format_err!("Mapping terminated before finishing to handle") }) }) - .and_then(move |result| { + .and_then(move |(result, _)| { info!( logger, "Done processing Ethereum call"; "function" => &call_handler.function, "handler" => &call_handler.handler, - // Replace this when `as_millis` is stable. - "secs" => start_time.elapsed().as_secs(), - "ms" => start_time.elapsed().subsec_millis() + "ms" => start_time.elapsed().as_millis(), ); result }), @@ -667,15 +665,13 @@ impl RuntimeHostTrait for RuntimeHost { format_err!("Mapping terminated before finishing to handle block trigger") }) }) - .and_then(move |result| { + .and_then(move |(result, _)| { info!( logger, "Done processing Ethereum block"; "hash" => block.block.hash.unwrap().to_string(), "number" => &block.block.number.unwrap().to_string(), "handler" => &block_handler.handler, - // Replace this when `as_millis` is stable. - "secs" => start_time.elapsed().as_secs(), - "ms" => start_time.elapsed().subsec_millis() + "ms" => start_time.elapsed().as_millis(), ); result }), @@ -773,14 +769,17 @@ impl RuntimeHostTrait for RuntimeHost { ) }) }) - .and_then(move |result| { + .and_then(move |(result, send_time)| { info!( logger, "Done processing Ethereum event"; "signature" => &event_handler.event, "handler" => &event_handler.handler, - // Replace this when `as_millis` is stable. - "secs" => start_time.elapsed().as_secs(), - "ms" => start_time.elapsed().subsec_millis() + "total_ms" => start_time.elapsed().as_millis(), + + // How much time the result spent in the channel, + // waiting in the tokio threadpool queue. Anything + // larger than 0 is bad here. The `.wait()` is instant. + "waiting_ms" => send_time.wait().unwrap().elapsed().as_millis(), ); result }),