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: added a timeout to the login command #991

Closed
wants to merge 2 commits into from
Closed

feat: added a timeout to the login command #991

wants to merge 2 commits into from

Conversation

alexal
Copy link
Contributor

@alexal alexal commented Aug 30, 2021

Closes #989

@alexal
Copy link
Contributor Author

alexal commented Aug 31, 2021

@craicoverflow have you had a chance to review the changes?

@craicoverflow
Copy link
Contributor

The build is failing - this needs to be fixed.

@craicoverflow have you had a chance to review the changes?

We have a number of tasks to complete, but don't worry - this is on the backlog.

internal/build/build.go Outdated Show resolved Hide resolved
@craicoverflow craicoverflow self-requested a review August 31, 2021 11:31
Copy link
Contributor

@craicoverflow craicoverflow left a comment

Choose a reason for hiding this comment

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

So, the best way to do this would be to use context.WithTimeout, but only on the auth requests.

I believe that the timeout should be focused on the network request, not the command itself.

Currently we are using context.WithCancel here, this could be replaced with context.WithTimeout.

Since one context is created for each OpenID client, using 30 seconds for each might be satisfactory (as when combined it gives 60 seconds) - looking for @wtrocki's opinion before we agree with this approach.

@wtrocki
Copy link
Collaborator

wtrocki commented Aug 31, 2021

So first callback requires human interaction (if you need to login). Second callback uses SSO so it is almost instant.
I like global timeout but if we want to go with individual ones it should be 60 for first and 10 seconds for second.

@craicoverflow
Copy link
Contributor

So first callback requires human interaction (if you need to login). Second callback uses SSO so it is almost instant.
I like global timeout but if we want to go with individual ones it should be 60 for first and 10 seconds for second.

Global timeout makes sense then. We should try to avail of the built-in context.WithTimeout for this then.

The context can be passed to login.Execute(ctx) from the login command:

func (a *AuthorizationCodeGrant) Execute(ctx context.Context, ssoCfg *SSOConfig, masSSOCfg *SSOConfig) error {

@craicoverflow
Copy link
Contributor

Needs rebase.

@wtrocki
Copy link
Collaborator

wtrocki commented Sep 2, 2021

Rebase needed.

@alexal
Copy link
Contributor Author

alexal commented Sep 3, 2021

@wtrocki , @craicoverflow please see a new PR #1027. This one can be closed as I lost my old local repo.

@alexal alexal closed this Sep 4, 2021
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.

Add a timeout when logging in via the web browser
3 participants