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: adds option not to raise exception when leaving context manager after lock expiration #3531

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

Conversation

julianolm
Copy link

@julianolm julianolm commented Feb 27, 2025

Fixes: #3532

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

I was having trouble using async locks with the context manager because it was failing when exiting the context manager after timeout had expired (even if my code executed successfully).

I would really like not to raise a LockNotOwnedError in the exit of the context manager (if I try to release a lock and it was already "released" then great!).

I understand just changing the behavior would be critical, so I added an option to just behave this way when desired instead.

Issue: #3532

@julianolm
Copy link
Author

@petyaslavova petyaslavova changed the title feat: adds option not to raise when leaving context manager after lock expiration feat: adds option not to raise exception when leaving context manager after lock expiration Feb 27, 2025
@petyaslavova
Copy link
Collaborator

Hi @julianolm, thank you for your contribution! Your change will be reviewed soon.

@petyaslavova
Copy link
Collaborator

Hi @julianolm, can you please check the reported errors from code linters?

@julianolm
Copy link
Author

Hey @petyaslavova , updated!!! Thanks!

@petyaslavova
Copy link
Collaborator

@julianolm you can run the linters locally - there are instructions in the contributing guide.
Instead of using the "invoke all-tests" command, you can just call "invoke linters" and you will see all reported errors and changes that are needed.

@julianolm
Copy link
Author

Oh, great. Sorry I missed it.
Now its ok.
Thanks again @petyaslavova

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.

Option not to raise when leaving context manager after lock expiration
3 participants