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

feat(2.0, nodejs): Silently request to stop background syncing when WalletMethodHandler is dropped #1793

Conversation

marc2332
Copy link
Contributor

@marc2332 marc2332 commented Dec 18, 2023

Description of change

This will make sure that the background syncing is stopped when the WalletMethodHandler is dropped. You might ask why this is useful as there is already destroyWallet method. Well, this is more like a "fallback" plan for when that method is not called yet the wallet is dropped. For example, I encountered that everytime I edited some frontend code in Firefly, that triggered webpack to reload the frontend, and thus removing from memory all the Wallets instances, without their stopBackgroundSync method called. This caused that if I wanted to log into a profile whose stopBackgroundSync method was not called before, now gave me a rocksdb error, because, the old wallet instance was still living in the background syncing thread, and thus the DB still locked.

Type of change

  • Enhancement

How the change has been tested

In firefly, but you can test it by starting the background syncing and never stopping, but destroying the wallet.

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

@marc2332 marc2332 changed the title feat(2.0, nodejs): Silently request stop background syncing when WalletMethodHandler is dropped feat(2.0, nodejs): Silently request to stop background syncing when WalletMethodHandler is dropped Dec 18, 2023
@marc2332 marc2332 changed the title feat(2.0, nodejs): Silently request to stop background syncing when WalletMethodHandler is dropped feat(2.0, nodejs): Silently request to stop background syncing when Wallet is dropped Dec 19, 2023
@marc2332 marc2332 changed the title feat(2.0, nodejs): Silently request to stop background syncing when Wallet is dropped feat(2.0, nodejs): Silently request to stop background syncing when WalletMethodHandler is dropped Dec 19, 2023
@marc2332
Copy link
Contributor Author

A potential case where a new Wallet instance is created quickly enough to throw a no available locks error, just after a previous wallet instance has been dropped without manually calling stopBackgroundSync and thus calling it asynchronously when it drops will be improved by #1797

Thoralf-M
Thoralf-M previously approved these changes Jan 8, 2024
Copy link
Member

@thibault-martinez thibault-martinez left a comment

Choose a reason for hiding this comment

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

Please rebase to remove the python errors and apply format 🙏🏻

Thoralf-M
Thoralf-M previously approved these changes Jan 8, 2024
Copy link
Member

@thibault-martinez thibault-martinez left a comment

Choose a reason for hiding this comment

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

Thank you 🙏🏻

@thibault-martinez thibault-martinez merged commit 7dfc8e3 into iotaledger:2.0 Jan 10, 2024
36 checks passed
@marc2332 marc2332 deleted the feat/2.0-silently-stop-background-syncing branch January 10, 2024 15:39
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.

4 participants