Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pdi-scanner): use a smaller USB buffer in development #5551

Conversation

eventualbuddha
Copy link
Collaborator

Overview

Closes #5541

Demo Video or Screenshot

❯ cargo run --example scan_forever --release
   Compiling pdi-scanner v0.1.0 (/media/parallels/WorkingFiles/code/vxsuite/libs/pdi-scanner)
    Finished `release` profile [optimized] target(s) in 1.53s
     Running `/media/parallels/WorkingFiles/code/vxsuite/target/release/examples/scan_forever`
waiting for sheet…
event: BeginScanEvent
event: EndScanEvent
Saved images from scan:
- Top: scan-0000-top.png
- Bottom: scan-0000-bottom.png
waiting for sheet…
^Creceived SIGINT
exiting

❯ NODE_ENV=production cargo run --example scan_forever --release
   Compiling pdi-scanner v0.1.0 (/media/parallels/WorkingFiles/code/vxsuite/libs/pdi-scanner)
    Finished `release` profile [optimized] target(s) in 3.28s
     Running `/media/parallels/WorkingFiles/code/vxsuite/target/release/examples/scan_forever`
Error: 
   0: failed to receive: timed out waiting on channel
   1: timed out waiting on channel

Location:
   libs/pdi-scanner/examples/scan_forever.rs:66

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Testing Plan

See above.

Copy link
Contributor

@arsalansufi arsalansufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

let is_production = match std::env::var("NODE_ENV") {
Ok(env) => env == "production",
Err(_) => false,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I'm unsure about is whether we also need to consider whether this is a VxDev setup vs. true prod. On VxDev, NODE_ENV is production, but REACT_APP_VX_DEV is set to true so that we can distinguish it from true prod, e.g.

function shouldUseProdCerts(): boolean {
return isNodeEnvProduction() && !isVxDev() && !isIntegrationTest();
}

My quick sense is that, since VxDev isn't using VMs, it doesn't need the smaller buffer.

So all probably fine as is, just wanted to flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do the simpler version to start. If it turns out VxDev doesn't work, we can update it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup sounds right to me!

@eventualbuddha eventualbuddha merged commit 5800d86 into main Oct 24, 2024
62 checks passed
@eventualbuddha eventualbuddha deleted the 5541-toggle-pdi-buffer-size-given-node_env-so-that-dev-works-out-the-box branch October 24, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toggle PDI buffer size given NODE_ENV so that dev works out the box
2 participants