Skip to content
New issue

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

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

Already on GitHub? # to your account

Reduce amount of blocking in blocks #2093

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bim9262
Copy link
Collaborator

@bim9262 bim9262 commented Oct 20, 2024

No description provided.

src/util.rs Outdated
@@ -7,6 +7,10 @@ use tokio::process::Command;

use crate::errors::*;

pub async fn file_exists(path: impl AsRef<Path>) -> bool {
tokio::fs::metadata(path).await.is_ok()
Copy link
Collaborator

@MaxVerevkin MaxVerevkin Nov 9, 2024

Choose a reason for hiding this comment

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

Is there a reason to choose this over tokio::fs::try_exists? And do we even need a separate util function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This matches the implementation that it was replacing exists: https://doc.rust-lang.org/nightly/src/std/path.rs.html#3030-3032

Perhaps all of the exists should be try_exists (either async or sync, spending on the context though)?

Replaced `exists` with `try_exists`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants