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: delete updater pending when is not a available update #8875

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

Conversation

beyondkmp
Copy link
Collaborator

refers to #8730

Copy link

changeset-bot bot commented Feb 18, 2025

🦋 Changeset detected

Latest commit: 7eec654

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
electron-updater Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -494,6 +510,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
}).`
)
this.emit("update-not-available", updateInfo)
await this.deletePendingUpdate()
Copy link
Collaborator

@mmaietta mmaietta Feb 19, 2025

Choose a reason for hiding this comment

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

Based on #8730, I think the request also is also to clean the pending dir on successful installation of an update as well.

That being said, I'm not sure if we want to do that in our doInstall

What about clearing the pending dir before the first emit? Not sure if that'll break any previous logic on a cached pending update though...might be worth double checking that.

this.emit("cleaning-pending-update-dir") // optional, may not be necessary?
await this.deletePendingUpdate()
this.emit("checking-for-update")

Also, might be worth renaming the function deletePendingUpdate to removePendingUpdateDirectory to be more explicit on purpose

Copy link
Collaborator Author

@beyondkmp beyondkmp Feb 20, 2025

Choose a reason for hiding this comment

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

Based on #8730, I think the request also is also to clean the pending dir on successful installation of an update as well.

Usually, after users complete an upgrade, they need to restart the app. If we delete files at the moment the user starts the app, the timing is not ideal, as it could slow down the app's startup speed.

What about clearing the pending dir before the first emit? Not sure if that'll break any previous logic on a cached pending update though...might be worth double checking that.

Alternatively, we could expose the delete interface, allowing users to decide when to delete the files themselves?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm very valid point on that, we can't impact start-up performance.

I'm adverse to that approach, as electron-updater is meant to be a drop-in replacement for electron's internal version. The goal of the package is to limit configuration/setup so that it "just works"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What about clearing the pending dir before the first emit? Not sure if that'll break any previous logic on a cached pending update though...might be worth double checking that.

If the download has already been completed but the update has not been applied for a while, and then another checkForUpdate is triggered, the downloaded files might be deleted. It seems that simply deleting them is not a good solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants