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

bug: avoid using ok_or(anyhow!(...)) #11580

Closed
hzxa21 opened this issue Aug 10, 2023 · 0 comments · Fixed by #11589
Closed

bug: avoid using ok_or(anyhow!(...)) #11580

hzxa21 opened this issue Aug 10, 2023 · 0 comments · Fixed by #11589
Assignees
Labels
type/bug Something isn't working
Milestone

Comments

@hzxa21
Copy link
Collaborator

hzxa21 commented Aug 10, 2023

Describe the bug

@wenym1 found that anyhow!(...) can take several hundred ms to construct (#6131) and there are several places in our codebase using ok_or(anyhow!(...)), which eagerly constructs the anyhow error and can significantly increase call latency even if there is no error happening.

We should switch to ok_or_else, which perform lazy evaluation, and avoid this usage in the future.

Places to fix:
https://rust-lang.github.io/rust-clippy/master/#/or_fun_call
cargo clippy -- -W clippy::or_fun_call

Error message/log

No response

To Reproduce

No response

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

No response

@hzxa21 hzxa21 added the type/bug Something isn't working label Aug 10, 2023
@github-actions github-actions bot added this to the release-1.2 milestone Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants