-
-
Notifications
You must be signed in to change notification settings - Fork 68
fix(sync): added client.wait_for_start() and improve error handling in sync daemon
#495
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
Conversation
…ff for server connection - Added error logging in daemon before re-throwing errors - Implemented exponential backoff when checking if the server is running - Addresses issue ActivityWatch/aw-qt#105
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 9b0d59f in 45 seconds
More details
- Looked at
101lines of code in2files - Skipped
0files when reviewing. - Skipped posting
2drafted comments based on config settings.
1. aw-sync/src/sync_wrapper.rs:35
- Draft comment:
The error message should reflect the actual total wait time instead of a fixed 10 seconds. Consider usingtotal_waitin the message. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is about a change made in the diff, specifically the error message in thewait_for_serverfunction. The suggestion to usetotal_waitin the error message is actionable and improves the accuracy of the error message, which is a valid code quality improvement.
The comment might be considered minor since it only affects the error message, not the logic. However, accurate error messages are important for debugging.
Improving error messages is a valid concern as it aids in debugging and understanding the issue when it occurs.
The comment is valid and should be kept as it suggests an actionable improvement to the error message.
2. aw-sync/src/sync_wrapper.rs:24
- Draft comment:
connect_timeoutshould use a fixed timeout for each connection attempt, not the increasingretry_delay. Consider using a separate fixed timeout value forconnect_timeout. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is suggesting a change in the logic of how timeouts are handled in thewait_for_serverfunction. The current implementation uses an exponential backoff strategy, which is a common approach for retry mechanisms. The suggestion to use a fixed timeout for each attempt could be a valid point if the exponential backoff is not appropriate for this use case. However, without more context on the intended behavior, it's hard to say definitively if this change is necessary.
I might be missing the context of why exponential backoff was chosen in the first place. It could be that the author intended to use this strategy for a specific reason, such as reducing load on the server or network.
The comment does raise a valid point about the potential misuse ofconnect_timeoutwith an increasing delay, which could lead to unexpected behavior. It's worth considering if the current implementation aligns with the intended use case.
The comment raises a valid concern about the use ofconnect_timeoutwith an increasing delay, which could lead to unexpected behavior. It should be kept for the author to consider if the current implementation aligns with the intended use case.
Workflow ID: wflow_kfoHpwCDSz9YrSKh
Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
4ca6c24 to
42cb5d8
Compare
There was a problem hiding this 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! Incremental review on 42cb5d8 in 15 seconds
More details
- Looked at
43lines of code in2files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. aw-sync/src/sync_wrapper.rs:24
- Draft comment:
Theconnect_timeoutfunction should not useretry_delayas its timeout. Instead, use a fixed timeout for each connection attempt and useretry_delayonly for the sleep duration between attempts. This ensures that each connection attempt has a reasonable timeout, regardless of the retry delay. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_qLiWQKZvrM9mjcwh
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Incremental review on 4723f32 in 24 seconds
More details
- Looked at
113lines of code in3files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. aw-client-rust/src/blocking.rs:83
- Draft comment:
Consider makingwait_for_serveran async function to avoid blocking the thread, especially since the rest of theAwClientmethods are async. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_NonIZFhTd36fJxxx
Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
There was a problem hiding this 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! Incremental review on 451367f in 10 seconds
More details
- Looked at
28lines of code in2files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. aw-client-rust/src/lib.rs:227
- Draft comment:
Consider updating the comment to reflect the new function namewait_for_startinstead ofserver. This will maintain consistency and avoid confusion. - Reason this comment was not posted:
Confidence changes required:50%
The renaming of the function fromwait_for_servertowait_for_startis consistent across both files. However, the comment inaw-client-rust/src/lib.rsstill mentionsserverinstead ofstart. This could lead to confusion.
Workflow ID: wflow_J0byOdZ9Ag5n3Cbh
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
451367f to
ed15ff5
Compare
There was a problem hiding this 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! Incremental review on ed15ff5 in 9 seconds
More details
- Looked at
50lines of code in3files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. aw-client-rust/src/blocking.rs:84
- Draft comment:
The function namewait_for_startis less descriptive thanwait_for_server. Consider reverting towait_for_serverfor clarity. - Reason this comment was not posted:
Confidence changes required:50%
The change fromwait_for_servertowait_for_startis consistent across files, but the function namewait_for_startis less descriptive thanwait_for_server. The original name clearly indicated the purpose of the function, which is to wait for the server to be ready. The new name could be misleading as it might imply waiting for the application to start rather than the server. This change affects multiple files, includingaw-client-rust/src/blocking.rs,aw-client-rust/src/lib.rs, andaw-sync/src/sync_wrapper.rs.
Workflow ID: wflow_tQo6iTnnTmqLItGc
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
ed15ff5 to
46b586e
Compare
There was a problem hiding this 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! Incremental review on 46b586e in 13 seconds
More details
- Looked at
54lines of code in3files - Skipped
0files when reviewing. - Skipped posting
2drafted comments based on config settings.
1. aw-client-rust/src/lib.rs:228
- Draft comment:
Thewait_for_startfunction is not async, but the comment suggests it should be. Consider implementing it as an async function if possible. - Reason this comment was not posted:
Confidence changes required:50%
The PR changes the function name fromwait_for_servertowait_for_startinaw-client-rust/src/blocking.rsandaw-client-rust/src/lib.rs. However, the functionwait_for_startinaw-client-rust/src/lib.rsis not async, and the comment// TODO: make asyncsuggests it should be. This could be a potential issue if the function is expected to be async in the future.
2. aw-sync/src/sync_wrapper.rs:16
- Draft comment:
The function callwait_for_serveris updated towait_for_start, which is consistent with the changes inaw-client-rust/src/blocking.rs. - Reason this comment was not posted:
Confidence changes required:0%
The PR changes the function name fromwait_for_servertowait_for_startinaw-client-rust/src/blocking.rs. The function call inaw-sync/src/sync_wrapper.rsis also updated towait_for_start. This is consistent with the changes made in the PR.
Workflow ID: wflow_nFwxbj7ETtfh0Zlu
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
client.wait_for_start() and improve error handling in sync daemon
… in sync daemon (ActivityWatch#495) * fix(sync): improve error handling in daemon and add exponential backoff for server connection - Added error logging in daemon before re-throwing errors - Implemented exponential backoff when checking if the server is running - Addresses issue ActivityWatch/aw-qt#105 * Apply suggestions from code review * refactor: move wait_for_server() into client * refactor: renamed wait_for_server to wait_for_start (same as in aw-client-python)
Important
Improves error handling in
aw-syncdaemon and adds exponential backoff for server connections inmain.rsandsync_wrapper.rs.daemon()inmain.rsbefore re-throwing errors.daemon_sync_cycle()inmain.rsto encapsulate sync operations and handle errors.wait_for_start()inaw-client-rust/src/lib.rsfor exponential backoff when connecting to the server.pull()insync_wrapper.rswithwait_for_start().This description was created by
for 46b586e. It will automatically update as commits are pushed.