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

TurboSync: Remove an extra while #10950

Merged

Conversation

kiminuo
Copy link
Collaborator

@kiminuo kiminuo commented Jun 28, 2023

@adamPetho
Copy link
Collaborator

If we remove it, how are we exiting the while (true) loop? LOC274

@kiminuo
Copy link
Collaborator Author

kiminuo commented Jun 28, 2023

cancel.ThrowIfCancellationRequested();.. it should be while (cancel.IsCancellationRequested) really. The loop should continue looping after Wallet.StartAsync() is callled until Wallet.StopAsync() is called.

It would be actually good to add a test for Wallet.PerformFinalSynchronizationAsync but it is not exactly trivial with all those dependencies. Maybe it's doable though.

@kiminuo kiminuo requested a review from turbolay June 28, 2023 08:17
@kiminuo kiminuo marked this pull request as ready for review June 28, 2023 08:17
@turbolay
Copy link
Collaborator

Why don't remove the while instead? I think that was the idea of 5ea5805

@kiminuo
Copy link
Collaborator Author

kiminuo commented Jun 28, 2023

Honestly, looking at the code, I'm more and more confused. I thought that PerformFinalSynchronizationAsync is a long-running task but then using (await HandleFiltersLock.LockAsync(cancel).ConfigureAwait(false)) would be hold for a really long time.

@turbolay: You know the design better than me.

Copy link
Collaborator

@molnard molnard left a comment

Choose a reason for hiding this comment

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

I believe the while makes no sense here - it is a leftover. In case of exception, the while won't retry. In case of success, the while won't iterate either.

@kiminuo
Copy link
Collaborator Author

kiminuo commented Jun 28, 2023

So the idea of PerformFinalSynchronizationAsync is that it does the synchronization once after the wallet is started?

@turbolay
Copy link
Collaborator

So the idea of PerformFinalSynchronizationAsync is that it does the synchronization once after the wallet is started?

Yes. Whether we should retry or not, catch the exception or not, was my final question that I asked here: #10896 (comment). @molnard took over after this

I thought that PerformFinalSynchronizationAsync is a long-running task but then using (await HandleFiltersLock.LockAsync(cancel).ConfigureAwait(false)) would be hold for a really long time.

This is true, the design for this is explained here: https://github.com/zkSNACKs/WalletWasabi/pull/10663/files#r1206981555
I will make a new PR to add comments on the usage of this lock

@kiminuo kiminuo changed the title TurboSync: Remove an extra break TurboSync: Remove an extra while Jun 28, 2023
@kiminuo kiminuo mentioned this pull request Jun 28, 2023
2 tasks
Copy link
Collaborator

@turbolay turbolay left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@molnard molnard left a comment

Choose a reason for hiding this comment

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

Remove cancel.ThrowIfCancellationRequested();

Copy link
Collaborator

@molnard molnard left a comment

Choose a reason for hiding this comment

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

ACK

@molnard molnard merged commit 913b169 into zkSNACKs:master Jun 29, 2023
8 of 9 checks passed
@kiminuo kiminuo deleted the feature/2023-06-28-TurboSync-extra-break branch June 29, 2023 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants