Skip to content

Back up old directory when updating #1486

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

Merged
merged 3 commits into from
Apr 2, 2020
Merged

Back up old directory when updating #1486

merged 3 commits into from
Apr 2, 2020

Conversation

code-asher
Copy link
Member

Rename the old directory with a timestamp before moving the new directory into place.

Also has a minor fix for a notification saying the update failed when it didn't (isLatest
won't be true since that version is still technically the older version).

Fixes #1483 .

@code-asher code-asher requested a review from nhooyr as a code owner April 2, 2020 21:25
@@ -696,10 +696,6 @@ index 0000000000..96fbd4b0bb
+ }
+
+ const json = await response.json();
+ if (!json.isLatest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this cause no errors to be reported if an update fails?

Copy link
Member Author

Choose a reason for hiding this comment

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

The response will only be a 200 if the update succeeded so it should already have bailed out on the line above. The problem with this line is that isLatest was always false since the currently running code was still the old version.

Although, that means I should log the status text and not just "unexpected response". Will do that right now.

@code-asher code-asher merged commit d2a3147 into master Apr 2, 2020
@code-asher code-asher deleted the update-backup branch April 2, 2020 22:28
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.

code-server deletes olds version when updating
2 participants