-
Notifications
You must be signed in to change notification settings - Fork 14
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
Delete ooni_home_autorun on hard reset #295
Conversation
main/actions.js
Outdated
const log = require('electron-log') | ||
const Sentry = require('@sentry/electron') | ||
|
||
const hardReset = () => { | ||
const ooni = new Ooniprobe() | ||
log.info('hardReset: performing a hard reset of the installation') | ||
fs.removeSync(getAutorunHomeDir()) |
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 think that what we ought to be doing is calling ooniprobe reset --force
with the OONI_HOME
environment variable set to getAutorunHomeDir
.
That way, if there is any additional cleanup operation that needs to happen on hard reset, we can implement it inside of probe-cli directly and not have to remember to keep it in sync between the two directories.
I don't think we should do that. The autorun home directory will be re-created automatically the next time it runs, but it will be empty. I guess one thing we need to think about is what is going to happen if the hard reset is executed while the autorun task is currently running. |
@hellais wrote:
Yeah, this would be an interesting scenario |
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.
The diff looks good to me. I have spent some time thinking about what could happen if a hard reset occurs while an autorun is running, and I don't know what could happen. 🤷
I guess the database write operations are going to fail when they are attempted. I tried to reproduce this by running
On the second run it worked fine, so I guess it's not so tragic that the running test will fail. I think we can go ahead and merge this. |
Closes ooni/probe#2071
Do we also need to stop autorun at this point?