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

Prevent future::get_or_*_insert_with to panic after inserting task was aborted #60

Merged
merged 4 commits into from
Dec 28, 2021

Conversation

tatsuya6502
Copy link
Member

This PR addresses the issue described in #59. So get_or_insert_with and get_or_try_insert_with methods in future::Cache will no longer panic if previous inserting task was aborted.

Changes

  • Add WaiterGuard to the value initializer used by these methods and it will ensure to remove the waiter (a lock) when enclosing async task is aborted.
  • Add unit test cases for the issue.

Fixes #59.

…sk was aborted

Add `WaiterGuard` to `future::value_initializer` which will ensure that the
waiter will be removed when the enclosing future has been aborted.

Fixes #59.
@tatsuya6502 tatsuya6502 added the bug Something isn't working label Dec 28, 2021
@tatsuya6502 tatsuya6502 added this to the V0.6.3 milestone Dec 28, 2021
Copy link
Member Author

@tatsuya6502 tatsuya6502 left a comment

Choose a reason for hiding this comment

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

Merging.

@tatsuya6502 tatsuya6502 merged commit d1d68cf into master Dec 28, 2021
@tatsuya6502 tatsuya6502 deleted the gh59-panic-on-get-or-insert branch December 28, 2021 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

moka::future::Cache::get_or_insert_with() panics if previously inserting task aborted
1 participant