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

Don't call the Twitter API until the user requests it #634

Closed
clone1018 opened this issue Apr 19, 2021 · 3 comments
Closed

Don't call the Twitter API until the user requests it #634

clone1018 opened this issue Apr 19, 2021 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@clone1018
Copy link
Member

Currently we poke the Twitter API every single time someone requests any of the pages under UserSettingsController.

https://github.com/Glimesh/glimesh.tv/blob/dev/lib/glimesh_web/controllers/user_settings_controller.ex#L136

Ideally we should hide expensive requests like this behind an initial user opt in to generate the link. The same would apply for TaxIDPro Form Link & Stripe Account Link.

@clone1018 clone1018 added bug Something isn't working good first issue Good for newcomers labels Apr 19, 2021
@clone1018
Copy link
Member Author

This caused downtime on Friday due to the Twitter API timing out before the page could load for the user.

@Eein
Copy link
Contributor

Eein commented Apr 28, 2021

Did an initial check - what should likely happen here is that a route is provided to handle the creation of the authorize URLs.

For context on anyone looking to tackle this issue:

How Ueberauth and omniauth in ruby (some other packages) do it is to provide an /auth/twitter (or any other alternative) route on the site that handles most of the behaviour located here:
https://github.com/glimesh/glimesh.tv/blob/dev/lib/glimesh/socials/twitter.ex#L29

The flow would look like

  1. GET /auth/twitter
  2. redirect to the authorize_url returned by socials/twitter.ex (above)

@clone1018
Copy link
Member Author

Solved in #904

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants