-
Notifications
You must be signed in to change notification settings - Fork 208
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
MountLock context manager (was: Exception handling in mount/unmount; Enable lint check W0706) #1799
base: dev
Are you sure you want to change the base?
Conversation
Hi Manual, There is more wrong then just a not handled exception. On a quick view I would assume that the goal of this code construct was that the code block in Today you would solve something like this with a context manager. But I am not sure at all and would need some time to dive into it. Best, As an example you see here that the exception is re-raised but
|
Hi Christian, Okay, I will try to embed this in a context manager. Regards, Manuel |
Please have a look if our (quit fresh) |
My advice would be to extract the five methods |
Hello Christian, Sorry for the late response. At the moment, I don't have much time to work on this PR. I have one question: Does it make sense to extract the mountLock methods into a context manager? The process lock prevents other processes from making changes at the same time and should always be removed after execution, so I understand why a context manager makes sense in this case. However, the mountLock, on the other hand, should only be created / removed if the folder was successfully mounted / unmounted. So the methods calls for creating / removing the lock can be placed at the end of the mount / umount methods without the need for a context manager. Or am I missing something? |
Hello Manuel,
That is OK. I just need to know.
I don't have an answer or opinion about it. I am not deep enough into that topic. But me or someone else will consider your comment when picking up this PR again. Best, |
Hello Manuel, The mounting is a very sensible and important part of the BIT codebase. There is too much going on under the hood and I am still not able to estimate the implications for our users. Taking risk-benefit calculation of your PR into account I can sleep better if we don't merge. My apologize for this. Keep in mind that your work is not waste. It triggered some other actions (e.g. PR #1942 ) improving BIT. So thank you for this. Regards, |
Related to PR #1799. Thank you to Manual for inspiring this PR.
W0706 complains if an Exception is directly raised back without any handling. First I wanted to remove the try / catch blocks completely, but the I've seen that there are also "finally" statements. Therefore I just added some logging, which caused the lint check to run successful.