Skip to content

feat(client):support single instance #522

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0xbrayo
Copy link
Member

@0xbrayo 0xbrayo commented Apr 4, 2025

Important

Add SingleInstance struct to ensure only one client instance runs at a time, with necessary dependencies and integration into AwClient.

  • Feature:
    • Introduces SingleInstance struct in single_instance.rs to ensure only one instance of the client runs at a time using file-based locking.
    • Integrates SingleInstance into AwClient in lib.rs by adding a single_instance field and initializing it in AwClient::new().
  • Dependencies:
    • Adds dirs, fs4, libc, log, and thiserror to Cargo.toml for handling file paths, file locking, logging, and error handling.
  • Misc:
    • Updates Cargo.lock to reflect new and updated dependencies.

This description was created by Ellipsis for 69d72b6. It will automatically update as commits are pushed.

@0xbrayo 0xbrayo marked this pull request as draft April 4, 2025 14:31
@0xbrayo
Copy link
Member Author

0xbrayo commented Apr 4, 2025

Pending testing :)

@0xbrayo 0xbrayo force-pushed the single-instance branch 2 times, most recently from a7e3049 to cea060e Compare April 12, 2025 18:28
@0xbrayo
Copy link
Member Author

0xbrayo commented Apr 12, 2025

Did some testing on linux, works as expected. Will do windows later

@0xbrayo 0xbrayo force-pushed the single-instance branch 4 times, most recently from c83ef58 to 69d72b6 Compare April 13, 2025 09:31
@0xbrayo 0xbrayo marked this pull request as ready for review April 13, 2025 09:34
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 69d72b6 in 1 minute and 48 seconds

More details
  • Looked at 320 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 drafted comments based on config settings.
1. aw-client-rust/src/single_instance.rs:27
  • Draft comment:
    Consider propagating the original io::Error for create_dir_all instead of mapping to a generic LockDirCreation error to provide more context.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
2. aw-client-rust/src/single_instance.rs:76
  • Draft comment:
    The Drop implementation manually drops the file by taking it and updating the atomic flag. Consider whether an explicit unlock (if available via the trait) would be more idiomatic, though dropping the file handle typically releases the lock.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
3. aw-client-rust/Cargo.toml:25
  • Draft comment:
    Consider specifying an explicit version for 'tokio-test' instead of using "*" to ensure reproducible builds.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. aw-client-rust/src/lib.rs:36
  • Draft comment:
    For idiomatic Rust, consider removing the explicit 'return' in get_hostname.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
5. aw-client-rust/src/lib.rs:225
  • Draft comment:
    Instead of panicking on parse failure in get_event_count, consider propagating an error.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. aw-client-rust/src/lib.rs:235
  • Draft comment:
    Consider making 'wait_for_start' async to avoid blocking the async runtime.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. aw-client-rust/src/single_instance.rs:77
  • Draft comment:
    Optionally, explicitly unlock the file (if supported) before dropping for clarity, rather than solely relying on dropping the file handle.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
8. aw-client-rust/Cargo.toml:17
  • Draft comment:
    Minor style note: The line for thiserror = "1.0" has trailing whitespace. For consistency with other lines, please remove the extra space at the end.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    While the comment is technically correct about the trailing whitespace, this is an extremely minor formatting issue that doesn't affect functionality. Most IDEs automatically handle whitespace, and this kind of nitpick creates unnecessary noise in the PR review. The rules specifically say not to make comments that are obvious or unimportant.
    The trailing whitespace could theoretically cause issues with some tools or scripts that are sensitive to whitespace. Some teams might have strict formatting requirements.
    Even if whitespace is important to the team, this is too minor to warrant a PR comment. If whitespace is critical, it should be handled by automated formatting tools or pre-commit hooks, not manual review comments.
    Delete this comment as it violates the rule about not making obvious or unimportant comments. Trailing whitespace in a Cargo.toml file is too minor to warrant a review comment.

Workflow ID: wflow_dt91vxoiTGabzSP4


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

codecov bot commented Apr 18, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.29%. Comparing base (656f3c9) to head (7d30abe).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
aw-client-rust/src/single_instance.rs 83.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #522      +/-   ##
==========================================
- Coverage   70.81%   70.29%   -0.53%     
==========================================
  Files          51       52       +1     
  Lines        2916     2962      +46     
==========================================
+ Hits         2065     2082      +17     
- Misses        851      880      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant