This repository was archived by the owner on Sep 30, 2024. It is now read-only.
github apps: sleep before redirecting to installations/new#53064
Merged
Conversation
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff c6be395...1d9446d.
|
Contributor
pjlast
approved these changes
Jun 7, 2023
pjlast
left a comment
Contributor
There was a problem hiding this comment.
Yeah makes 100% sense, I've run into this issue with other GitHub features as well. Webhooks for example: you can get a webhook trigger that a user has been added to an org, and then if you immediately query the list of users in that org, the user won't show yet.
An alternative is to not have the App install be part of the creation flow, but I think this is a decent mitigation for now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that every once in a while (~5-10% of the time?), GitHub would 404 after it creates the new app and attempts to redirect to the page to install it. I'd think I did something wrong at first, but I would come back to the page a minute later and it'd be functional again. I think there's just a small race condition between GitHub finishing creating the app on their end and Sourcegraph redirecting to the new app's install page.
This PR just introduces a small delay before the redirect event to try to smooth this out. The sleep delay amount was chosen purely based on empirical evidence. I didn't see the 404s after adding a 3s delay and creating about ~20 new Apps. It's possible an even smaller delay would suffice, given we probably also have lower-than-normal latency when following the workflow from our locally-running instances, but 3s doesn't feel too long to wait.
Test plan
Aggressive manual testing. 😛