{"action":"created","issue":{"url":"https://api.github.com/repos/interledger-rs/interledger-rs/issues/275","repository_url":"https://api.github.com/repos/interledger-rs/interledger-rs","labels_url":"https://api.github.com/repos/interledger-rs/interledger-rs/issues/275/labels{/name}","comments_url":"https://api.github.com/repos/interledger-rs/interledger-rs/issues/275/comments","events_url":"https://api.github.com/repos/interledger-rs/interledger-rs/issues/275/events","html_url":"https://github.com/interledger-rs/interledger-rs/pull/275","id":489595677,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE0Mzc3Mzk2","number":275,"title":"fix(examples): avoid unnecessary blocking in simple example","user":{"login":"bstrie","id":865233,"node_id":"MDQ6VXNlcjg2NTIzMw==","avatar_url":"https://avatars2.githubusercontent.com/u/865233?v=4","gravatar_id":"","url":"https://api.github.com/users/bstrie","html_url":"https://github.com/bstrie","followers_url":"https://api.github.com/users/bstrie/followers","following_url":"https://api.github.com/users/bstrie/following{/other_user}","gists_url":"https://api.github.com/users/bstrie/gists{/gist_id}","starred_url":"https://api.github.com/users/bstrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bstrie/subscriptions","organizations_url":"https://api.github.com/users/bstrie/orgs","repos_url":"https://api.github.com/users/bstrie/repos","events_url":"https://api.github.com/users/bstrie/events{/privacy}","received_events_url":"https://api.github.com/users/bstrie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2019-09-05T08:10:08Z","updated_at":"2019-09-06T12:30:31Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/interledger-rs/interledger-rs/pulls/275","html_url":"https://github.com/interledger-rs/interledger-rs/pull/275","diff_url":"https://github.com/interledger-rs/interledger-rs/pull/275.diff","patch_url":"https://github.com/interledger-rs/interledger-rs/pull/275.patch"},"body":"Upon running the readme that executes the simple example, it first compiles the interledger-node binary from source with `cargo build  --bins` and once that's finished it runs the nodes using `cargo run`. The reason that these steps are separated (since `cargo run` already implies `cargo build`) is that we want to send the output of the first command to stdout so that the user has visual indication that compilation is happening, but we want to send the output of the second command to the logs. However I think we may currently be exposing some strange behavior of Cargo where the subsequent `cargo run` spends quite a long time blocked on waiting for the prior explicit `cargo build` to free the file lock on the build directory, despite the fact that the `cargo build` has long since finished. The easy way to visualize the delay is that our script prints one dot per second while waiting for the nodes to start up, here's the relevant excerpt:\r\n```\r\n  Compiling interledger v0.4.0 (/Users/bstriegel/Code/interledger-rs/crates/interledger)\r\n    Finished dev [unoptimized + debuginfo] target(s) in 2m 47s\r\n\r\nWaiting for Interledger.rs nodes to start up...\r\n.......................................................................\r\nThe Interledger.rs nodes are up and running!\r\n```\r\nThat's over a minute spent doing nothing but waiting *after* the `cargo build` has finished but *before* the `cargo run` thinks it has the go-ahead to proceed. In contrast, here's what it looks like if the README invokes the binaries directly rather than via `cargo run`:\r\n```\r\nWaiting for Interledger.rs nodes to start up...\r\n..\r\nThe Interledger.rs nodes are up and running!\r\n```\r\nOn my machine this causes the node start-up phase to take 2 seconds rather than 71. The current situation is especially unfortunate since the script output would lead a new or prospective user (who is just the person we expect to be running this example) to believe that our nodes are spending all that time slowly initializing, when in fact the machine is doing nothing at all.\r\n\r\nThis PR makes it so that we bypass `cargo run` when invoking the interledger-node binary in order to sidestep the problem, invoking the binaries directly. We don't hardcode any absolute paths because we don't want to assume that we know where the user is invoking this from (they could be doing `./run-md.sh ../examples/simple/README.md` or `../../scripts/run-md.sh README.md` or anything in between), so instead we use git to find the root of the repository and then navigate starting from there.\r\n\r\n[This PR is based on #274, which fixes a bug that prevents the simple example from working at all]"},"comment":{"url":"https://api.github.com/repos/interledger-rs/interledger-rs/issues/comments/528835630","html_url":"https://github.com/interledger-rs/interledger-rs/pull/275#issuecomment-528835630","issue_url":"https://api.github.com/repos/interledger-rs/interledger-rs/issues/275","id":528835630,"node_id":"MDEyOklzc3VlQ29tbWVudDUyODgzNTYzMA==","user":{"login":"gakonst","id":17802178,"node_id":"MDQ6VXNlcjE3ODAyMTc4","avatar_url":"https://avatars0.githubusercontent.com/u/17802178?v=4","gravatar_id":"","url":"https://api.github.com/users/gakonst","html_url":"https://github.com/gakonst","followers_url":"https://api.github.com/users/gakonst/followers","following_url":"https://api.github.com/users/gakonst/following{/other_user}","gists_url":"https://api.github.com/users/gakonst/gists{/gist_id}","starred_url":"https://api.github.com/users/gakonst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gakonst/subscriptions","organizations_url":"https://api.github.com/users/gakonst/orgs","repos_url":"https://api.github.com/users/gakonst/repos","events_url":"https://api.github.com/users/gakonst/events{/privacy}","received_events_url":"https://api.github.com/users/gakonst/received_events","type":"User","site_admin":false},"created_at":"2019-09-06T12:30:31Z","updated_at":"2019-09-06T12:30:31Z","author_association":"MEMBER","body":"> Darwin XXX 18.7.0 Darwin Kernel Version 18.7.0: XXX; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64"}}
{"actor":{"display_login":"gakonst"}}