After apm upgrade, same packages still require upgrades in UI


#1

I’m running atom on a fully updated OSX 10.12.2 machine. I launched Atom and checked for updates. For giggles, I went to the command line and ran apm upgrade, which showed the same 3 packages. I upgraded from the CLI but the UI still showed 3 updates pending. I closed the Preferences tab and tried again but got the same results until I restarted Atom.

Is this the expected behavior?


#2

No, it is not. I’ll try to explain why it happens, why a fix is difficult, and what we’re doing to address it in future versions of Atom.

Updates are cached to improve performance the first time after updates are checked (which generally happens as soon as you open Atom). This is the only time that updates are automatically checked for without interacting with Atom in some other way (ie, going to the Updates panel).
The cache is cleared either when it reaches the cache timeout (10 minutes), or when packages are upgraded.
Now, the problem is that when you upgrade packages from within Atom, it emits events when packages finish updating. The cache gets sent those events and clears the cache. However, the apm CLI does not have any way of sending those events to Atom. Basically, the settings-view shells out to apm, and then interprets the results apm sends back to emit the correct events. When you run apm directly, the event sending doesn’t happen. Which means settings-view still thinks that you haven’t upgraded the packages, because it doesn’t know any better.
This is exacerbated by the cache, because when you think “wow, this is a bug” and try reopening the Updates panel, it hits the cache (since it’s under 10 minutes and no events have been received) and returns the same list.

So that’s pretty much why it’s difficult to fix: it’s hard to get a command-line tool to communicate to Atom. In future versions of Atom, explicitly clicking the “Check for Updates” button will clear the cache, returning the correct results.


#3

Thanks for the explanation. I get that it’s an issue but as a systems guy, the answer seems obvious to me: have apm update the cache to remove the packages it has updated. But I’m not a coder, per se. Regardless, good luck with this and the rest of the project.