-
Notifications
You must be signed in to change notification settings - Fork 131
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
[Enhancement] Avoid blocking UI while adding existing repo #1643
base: master
Are you sure you want to change the base?
Conversation
Hi! @real-yfprojects , is this right ? like the UI is not freezing now, but after reverting back to the old changes I cant reproduce the issue anymore, I've tried editing the settings.db and even deleted the testing version. Any clue what I did wrong ? |
I don't know what you were experiencing before, but this looks good. What happens when you close the dialog, the main window, quit vorta or try to edit anything inside vorta? |
Hi! Actually that was my mistake 😓 , I was running vorta from the backup repo and reverted the changes in main repo 😓 But is this the required solution ? like are there more changes required ? |
As I said. This is the right approach. What happens when you close the dialog, the main window or quit vorta? |
005e97f
to
b250143
Compare
Hi! this seems to work on my machine! waiting for your review 😄 also I've had a question about migrations, how can I perform the migrations 🤔 |
@m3nu What was your Intention with the PR, would you consider it fine when the GUI stays responsive but you still can't do anything else while borg is running? |
This code was written long ago. It didn't seem important to do, anything else, while adding a repo. No specific consideration. |
But as per the current GUI, you can not do anything until you close the dialog displayed 🤔 |
Which migrations? Usually vorta migrates its database automatically. |
Oh, okay, means whenever I run vorta it applies the migrations ? |
Yes, if needed. |
96f9671
to
85e9d09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right?
Besides some minor problems this is right.
src/vorta/views/repo_add_dialog.py
Outdated
thread.result.connect(self.run_result) | ||
self.thread = thread # Needs to be connected to self for tests to work. | ||
self.thread.run() | ||
job = BorgInfoRepoJob(params['cmd'], params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be queued in the default
queue rather than the repo specific queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I guess the BorgInfoRepoJob
is used to validate existing repo right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right. You have to pass an extra argument iirc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right. You have to pass an extra argument iirc.
Hi! sorry for being inactive, I was sick 😅
I see the BorgJob accepting 3 params, 2 are already there, the third one should be sending value default
by default since it is not provided 🤔 I was wondering how it's deciding about queue (this question might sound dumb but 😅 )
is this the default
value we are talking about 🤔 , because jobs like backup are added to 1
I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this line:
vorta/src/vorta/application.py
Line 113 in 1f12782
job = BorgCreateJob(msg['cmd'], msg, profile.repo.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! added the code, but is there any way to verify it that it is going in default
queue since I'm unsure it's working properly :)
src/vorta/views/repo_add_dialog.py
Outdated
@@ -211,6 +214,11 @@ def password_listener(self): | |||
self.passwordLabel.setText(translate('utils', msg)) | |||
return not bool(msg) | |||
|
|||
def cancel_job(self): | |||
if self.job: | |||
self.job.cancel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly this only cancelt the job if its already running. If the job manager hasn't picked up the job yet, that is the job still sits in the queue, it won't be cancelled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! I'm a bit confused testing this, any suggestion on how can I test this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there is no way to reproduce this with the GUI. So you can decide not to deal with it but instead write a code comment on the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there is no way to reproduce this with the GUI. So you can decide not to deal with it but instead write a code comment on the issue.
The code will be included in cancel_job
method since it will check for both, if running or in queue, should I create a duplicate method for that and comment it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! @real-yfprojects , Since this is not reproducible, I'm not sure that the code will work or not, then is it okay to push the code even it is commented ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can only decide after seeing the code.
I noticed that the |
when we try to cancel (close) the add repo dialog without hitting the OK? I noticed that too, I added a try-except block for that in |
The cancel button should work now 👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are n't setting a meaningful status message yet which was requested in #1306.
src/vorta/views/repo_add_dialog.py
Outdated
if self.job: | ||
self.job.cancel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no self.job
currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no
self.job
currently.
Hm! The close()
method is working!, but I also noticed that you have to cancel the job within a specific time gap it might vary from machine to machine i guess, but after that time gap it adds the repo anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c234fca
to
7edd15f
Compare
- Avoids freezing UI when an existing repo is added Closes borgbase#1306
7edd15f
to
9ac38a1
Compare
Hi! and sorry I was away leaving this PR open with no activity, I was actually having my Practical exams 😅 I've updated the code accordingly, waiting for your review @real-yfprojects 😄 |
Pls also show a status message while |
Sorry! did not get that exactly |
Hi! Did you mean, while the app is backing up the data? l instead of messages like |
No it should show a message while the repository is accessed (verified) for the first time. Something like |
Hi! @real-yfprojects, sorry, this is taking longer than expected, I'm completely engrossed in preparation of my upcoming semester exam from May 8th. I will be completing this in a slow pace till then. Sorry for inconvenience :) |
No worries. |
Description
Related Issue
Closes #1306
Motivation and Context
When adding a existing repository the UI freezes, this change might solve this issue
How Has This Been Tested?
I've tested this by adding a repository which is used to crash the UI
Screenshots (if appropriate):
Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.