Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Add a core config core.automaticallyUpdate to disable Atom autoupdate. - #9990

Merged
maxbrunsfeld merged 4 commits into
atom:masterfrom
scv119:test
Jan 7, 2016
Merged

maxbrunsfeld merged 4 commits into
atom:masterfrom
scv119:test

Conversation

@scv119

@scv119 scv119 commented Dec 9, 2015

Copy link
Copy Markdown
Contributor

This PR does following:

  • Added a config core.automaticallyUpdate. This config is enabled by default, but if user disable it, the new Atom window won't check update/schedule update on startup.
  • I didn't observer the config changes after initialization, which means if user change the automaticallyUpdate config, it won't change the autoupdate behavior until user quit and start Atom again, but we could observer this changes if we think it's necessary.
  • Remove the build option --no-auto-update and revert all related code introduced in Add --no-auto-update while run scripts/build to disable autoupdate #8721

What I have tested:

  • run the scrip/build to build a new Atom.app.
  • noticed the enableAutoupdate is selected by default, and the checkUpdate button showed up in Atom menu.
  • disable enableAutoupdate option, open a new Atom window, the checkUpdate button disappeared from Atom menu.
  • Note that since the build of Atom don't have certs, so I can't tell if the download is happening or not.

@scv119 scv119 changed the title Add a core config core.enableAutoupdate to disable atom Autoupdate. Add a core config core.enableAutoupdate to disable Atom autoupdate. Dec 9, 2015
@scv119
scv119 force-pushed the test branch 2 times, most recently from c5f27e5 to ee3bc59 Compare December 10, 2015 00:05
@Zireael07

Copy link
Copy Markdown

Great!

@philipgiuliani

Copy link
Copy Markdown
Contributor

If i have autoupdate disabled, its still possible to check and install manually an update?

@scv119

scv119 commented Dec 10, 2015

Copy link
Copy Markdown
Contributor Author

@philipgiuliani My current plan is hide the checkUpdate button as well, so there is no way manually trigger the update.

@benogle benogle added the atom label Dec 10, 2015
@benogle

benogle commented Dec 10, 2015

Copy link
Copy Markdown
Contributor

cc @maxbrunsfeld @nathansobo

@Zireael07

Copy link
Copy Markdown

@scv119: If I were you, I wouldn't hide the button. Disabled autoupdate should still allow me to check for updates manually if I want to. This way, autoupdate wouldn't eat my limited bandwidth or slow my net down to a crawl when I want to do other stuff, but I could check for updates once I was back to the unlimited connection and/or stopped watching YT. (just an example, btw)

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Disabled autoupdate should still allow me to check for updates manually if I want to.

I am ok with that. @scv119 What do you think?

@scv119

scv119 commented Dec 10, 2015

Copy link
Copy Markdown
Contributor Author

Makes sense for me. I will update the PR.

@scv119

scv119 commented Dec 11, 2015

Copy link
Copy Markdown
Contributor Author

Addressed the comments:

  • Disable the config still allow user to manually check update
  • Toggle disable/enable of the config will schedule/cancel the autoupdate interval.

@philipgiuliani

Copy link
Copy Markdown
Contributor

Really cool 👍 Like this, the feature makes sense to me!

Comment thread src/config-schema.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

enableAutoUpdate?

@kevinsawicki

Copy link
Copy Markdown
Contributor

While looking at the fs calls in config.coffee I came across these lines: https://github.com/scv119/atom/blob/test/src/config.coffee#L752-L754

If these lines trigger an fs exception in the main process then the app will fail to load and fail to update so the person will be in a permanently bad state. I know they are unguarded currently in the render process but it would seem worth wrapping them in a try / catch in this pull request to ensure they don't impact people.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Note to self (:tophat: @kevinsawicki): Update this text to remind people to update Atom before reporting issues.

@scv119

scv119 commented Dec 16, 2015

Copy link
Copy Markdown
Contributor Author

hmm, I might have done something wrong

@scv119 scv119 reopened this Dec 16, 2015
@scv119 scv119 changed the title Add a core config core.enableAutoupdate to disable Atom autoupdate. Add a core config core.automaticallyUpdate to disable Atom autoupdate. Dec 16, 2015
@maxbrunsfeld

Copy link
Copy Markdown
Contributor

I'm not sure what's the best way to handle the exception in this case.

I think that what you did is fine, but could you add a test for that handling? It would be good to have a test that sets up one of those file system APIs to throw an exception, and assert that the config keeps working consistently.

Something like this:

describe ".loadUserConfig", ->
  # ...

  describe "when the config file fails to load", ->
    beforeEach ->
      spyOn(fs, 'existsSync').andCallFake -> throw new Error("EPERM")

    it "does not try to save later changes to disk", ->
      atom.config.loadUserConfig()
      atom.config.set("foo.bar", "baz")
      advanceClock(100)
      expect(atom.config.save).not.toHaveBeenCalled()
      expect(atom.config.get("foo.bar")).toBe "baz"

@scv119

scv119 commented Jan 7, 2016

Copy link
Copy Markdown
Contributor Author

@maxbrunsfeld test added.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Alright @scv119, thanks for this!

maxbrunsfeld pushed a commit that referenced this pull request Jan 7, 2016
Add a core config `core.automaticallyUpdate` to disable Atom autoupdate.
@maxbrunsfeld
maxbrunsfeld merged commit ec66a66 into atom:master Jan 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants