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: return sites from db for email login #754

Merged
merged 3 commits into from
May 5, 2023

Conversation

harishv7
Copy link
Contributor

@harishv7 harishv7 commented May 5, 2023

Problem

We are making unnecessary Github calls on /sites page especially on email login flow when this could be a call to our DB. In light of us reaching the limits of Github api, we should try to prevent excessive calls.

Closes IS-165

Solution

Added a check on getSites to return the list of site names for the user from our DB (only if it is a non-admin and non-github flow user).

Breaking Changes

  • Yes - this PR contains breaking changes
    • Details ...
  • No - this PR is backwards compatible

Deploy Notes

Note minor dependency on isomerpages/isomercms-frontend#1265
Needs to be deployed together

@@ -128,7 +128,6 @@ export class SitesRouter {

router.get(
"/",
this.statsMiddleware.countGithubSites,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the countGithubSites middleware to prevent excessive calls to github

cc @isomerpages/iso-engineers

Comment on lines +18 to +21
lastUpdated?: GitHubRepositoryData["pushed_at"]
permissions?: GitHubRepositoryData["permissions"]
repoName: GitHubRepositoryData["name"]
isPrivate: GitHubRepositoryData["private"]
isPrivate?: GitHubRepositoryData["private"]
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm actually removing isPrivate has implications specifically for loading homepages on private repos - without this param available the images on editHomepage don't load properly. I feel like this can be a future fix though since the affected repos should be small, but let's check with prod ops first if any existing email login sites are private

Copy link
Contributor Author

@harishv7 harishv7 May 5, 2023

Choose a reason for hiding this comment

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

We should then be tracking this info in our DB right? Should we add a column to track this?

But yes, for now, lets check with Ops

Copy link
Contributor

@kishore03109 kishore03109 left a comment

Choose a reason for hiding this comment

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

LGTM for the scope of this pr, but I do share the concens that Alex has, we would need to tell ops about this + plan to rectify this. I am sure that we will have private repos for email login in the future.

src/services/identity/SitesService.ts Outdated Show resolved Hide resolved
@harishv7 harishv7 merged commit fd30cbe into develop May 5, 2023
@harishv7 harishv7 deleted the is-165-fetch-sites-from-db-email-flow branch May 5, 2023 08:29
This was referenced May 8, 2023
alexanderleegs added a commit that referenced this pull request May 9, 2023
* fix: close pull request (#751)

* Fix: publish button delay (#752)

* Fix: publish button delay

* Fix: tests

* Fix: move review request status check into router

* feat: return sites from db for email login (#754)

* feat: return sites from db for email login

* fix: tests

* fix: use lodash function for type guard

* fix(githhub service): get call to github to prevent race condition (#756)

* fix(githhub service): get call to github to prevent race condition

* fix(github service): throw error if directory name not defined

* style(github service): add comments for clarity

* fix: tests

---------

Co-authored-by: Alexander Lee <[email protected]>

* Fix: handle updating of files in root directory (#761)

* fix: create .keep first when rename subfolder (#762)

* 0.26.0

---------

Co-authored-by: seaerchin <[email protected]>
Co-authored-by: Alexander Lee <[email protected]>
Co-authored-by: Harish <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants