-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(electron-updater): return correct release notes & name #2743
fix(electron-updater): return correct release notes & name #2743
Conversation
We cannot use API because it has rate limiting and updater will be blocked very soon. |
Per comments the original code already uses the API on nearly every update check. The rate limit is 60 calls per hour |
@develar ah, I had it wrong in my previous comment. It's 60 requests per hour per IP, independent of API URL. However, the fact still remains that the Are you seeing complaints about the rate limiting impacting people's updates? If not, given how widely this module is used, I'd suggest that it's not an issue, and when it becomes one developers are working around it by reducing their request rates. Finally, if you are still insistent that this PR can't be accepted as-is, please let me know what changes can be made to make it acceptable. I'm motivated to get this fixed quickly, and I'd rather not play a "will this make the maintainers happy?" guessing game. |
Just thought I'd add a bit more color to my thought process here. I originally rewrote this to use the atom feed for 100% of the functionality. However I noticed early on that there's no data in the atom feed to determine whether the prerelease flag is set (see for yourself here). "No bother," I thought, and I added an All was well and good, until I ran This made me realize that I need to test directly whether or not the prerelease flag is set. My only options to do this are to go to the API, or to scrape the I then considered putting things back to the way they were, and only using the API to test whether a build is prerelease. However since the original code was already hitting the API for the majority of update checks (i.e., cases when As I said, I'm motivated to see this fixed/released, so you can expect a very fast turnaround on any suggested improvements. Until this is merged/released, I'm left to suffer with this nonsense in my |
We do not use GitHub API in our electron-updater default provider. Only private. Please point me to code if you insist that it is used.
Yes. That's why we don't use API :) You are from New Zealand, but think about people from third world countries like Russia and Belarus. |
I hate this game too. Don't worry — in most cases we accept PR as is (even with code style issues or so on, — this stupid work can be done by me). I suggest — please add special option to electron-updater |
@develar see This is called from |
@benjamincburns Thanks, it is bug, API should be used only for GitHub Enterprise. |
@develar ok, in that case how should prerelease status be evaluated? Is it fine to assume that projects are using semver? |
I ask because your existing tests guard against this assumption. |
Definitely not. There is one trick — Hmm... so, I don't understand your issue — we do check right now that version specified in the atom.feed pre-release or not (using |
Either way, to understand the original issue I'm trying to solve, read through the current code (before my changes), and think about what happens when allowPrerelease is |
that is, |
Hopefully now you see my quandary, and why I wrote the code for this PR twice. :-) You either need to relax the constraint that the prerelease flag must be respected, or you need to relax the constraint that the API cannot be used. |
@@ -196,7 +196,7 @@ Object { | |||
"url": "TestApp-Setup-1.1.0.exe", | |||
}, | |||
], | |||
"releaseName": "v1.5.2-beta.3", |
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.
@develar actually, the easiest way to see why this is broken is to look here at the changes I had to make in the snapshot file here, and at Line 213. At present your snapshot doesn't match the state of the releases in your test project.
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.
That is, per https://github.com/develar/__test_nsis_release/releases.atom or https://api.github.com/repos/develar/__test_nsis_release/releases, there is no release with empty release notes, a releaseName of v1.5.2-beta.3
, and a tag of v1.1.0
.
I have fixed API usage — 4f7f66e |
Got the issue. Indeed. Well, fix is easy — we must fix |
Ok, re: 4f7f66e, I wasn't aware that this worked to produce a valid JSON response: |
@develar are you doing that now, or suggesting that I amend this PR to do this? |
No.
Tests will fail :) If you don't like it — just introduce option to use GitHub API as was proposed and use it in your project. But I doubt that it will be broken.
No, I wait this fix from you, thanks in advance. |
I don't mind, but I'd rather you accepted #2750 in that case. If you review it I think you'll agree that it's a good change ;-)
No problem, and thanks for sticking with me! |
b1518c3
to
8f919b6
Compare
@develar - changed as suggested. Hopefully this is more to your taste. |
whoops, looks like I had a couple of lint goofs - fixing those up now |
Makes it so that when the most recently published release is a prerelease build, the GitHubProvider supplies the correct releaseName and releaseNotes. Prior to this change, releaseName and releaseNotes were always set to the name and notes from the latest published build, even if it was prerelease, and even if allowPrerelease was false. fixes electron-userland#2742
8f919b6
to
5042772
Compare
... that should do it |
@develar I'm under a tight deadline here - is there any chance that this will be merged/released in the next 24h? If not, I may wind up needing to publish a forked package under an obscure name to keep with my deadline. :-( Why not use the scripts I linked to earlier? It turns out |
Actually, I think I need to go ahead and do that anyway so I can start testing my builds. If you're able to publish/release before my testing is done I'll happily unpublish my forked package. |
2.21.6 published |
Thanks! @develar! |
Refactors GitHubProvider.ts to fetch release information solely from theGitHub API rather than the atom xml feed, as the atom xml feed doesn'tindicate whether or not a release is marked as prerelease, and becausethe API was being used whenever allowPrerelease was false (likely thevast majority of requests).Makes it so that when the most recently published release is a
prerelease build, the GitHubProvider supplies the correct releaseName
and releaseNotes. Prior to this change, releaseName and releaseNotes
were always set to the name and notes from the latest published build,
even if it was prerelease, and even if allowPrerelease was false.
fixes #2742