Skip to content

Commit

Permalink
Disable flush_blocking in Sender on wasm (#6339)
Browse files Browse the repository at this point in the history
### What
This avoids a lint related to using blocking `recv()` on wasm buids.

This method was added as part of
#6335 but is not actually needed
by the viewer, only the SDK, which we don't build on wasm yet.

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6339?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6339?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/6339)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.

---------

Co-authored-by: Andreas Reich <[email protected]>
  • Loading branch information
jleibs and Wumpf committed May 15, 2024
1 parent 94352d4 commit 94cfda2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ disallowed-methods = [

# There are many things that aren't allowed on wasm,
# but we cannot disable them all here (because of e.g. https://github.com/rust-lang/rust-clippy/issues/10406)
# so we do that in `clipppy_wasm.toml` instead.
# so we do that in `clippy_wasm.toml` instead.
]

# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names
Expand Down
4 changes: 4 additions & 0 deletions crates/re_smart_channel/src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ impl<T: Send> Sender<T> {
}

/// Blocks until all previously sent messages have been received.
///
/// Note: This is only implemented for non-wasm targets since we cannot make
/// blocking calls on web.
#[cfg(not(target_arch = "wasm32"))]
pub fn flush_blocking(&self) -> Result<(), SendError<()>> {
let (tx, rx) = std::sync::mpsc::sync_channel(0); // oneshot
self.tx
Expand Down
16 changes: 11 additions & 5 deletions scripts/ci/rust_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,23 @@ def run_cargo(cargo_cmd: str, cargo_args: str, clippy_conf: str | None = None) -
print(f"> {cmd_str}")
start_time = time.time()

env = os.environ.copy()
env["RUSTFLAGS"] = "--deny warnings"
env["RUSTDOCFLAGS"] = "--deny warnings"
additional_env_vars = {}
additional_env_vars["RUSTFLAGS"] = "--deny warnings"
additional_env_vars["RUSTDOCFLAGS"] = "--deny warnings"
if clippy_conf is not None:
env["CLIPPY_CONF_DIR"] = (
additional_env_vars["CLIPPY_CONF_DIR"] = (
f"{os.getcwd()}/{clippy_conf}" # Clippy has issues finding this directory on CI when we're not using an absolute path here.
)

env = os.environ.copy()
env.update(additional_env_vars)

result = subprocess.run(args, env=env, check=False, capture_output=True, text=True)
if result.returncode != 0:
print(f"'{cmd_str}' failed with exit-code {result.returncode}. Output:\n{result.stdout}\n{result.stderr}")
env_var_string = " ".join([f'{env_var}="{value}"' for env_var, value in additional_env_vars.items()])
print(
f"'{env_var_string} {cmd_str}' failed with exit-code {result.returncode}. Output:\n{result.stdout}\n{result.stderr}"
)
sys.exit(result.returncode)

return Timing(cmd_str, time.time() - start_time)
Expand Down

0 comments on commit 94cfda2

Please sign in to comment.