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

Fix the bug that user may logout if GetUserByID return unknow error #29964

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

lunny
Copy link
Member

@lunny lunny commented Mar 21, 2024

backport #29962

This PR fixed a bug when the user switching pages too fast, he will logout automatically.

The reason is that when the error is context cancelled, the previous code think user hasn't login then the session will be deleted. Now it will return the errors but not think it's not login.

…a#29962)

This PR fixed a bug when the user switching pages too fast, he will
logout automatically.

The reason is that when the error is context cancelled, the previous
code think user hasn't login then the session will be deleted. Now it
will return the errors but not think it's not login.

---------

Co-authored-by: wxiaoguang <[email protected]>
@lunny lunny added the type/bug label Mar 21, 2024
@lunny lunny added this to the 1.21.9 milestone Mar 21, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 21, 2024
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 21, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Mar 21, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 21, 2024
@wxiaoguang
Copy link
Contributor

I do not think it needs to be backported. Becaseu 1.21 uses user_model.GetUserByID(db.DefaultContext, it won't be canceled.

@wxiaoguang wxiaoguang added the lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged label Mar 21, 2024
@lunny
Copy link
Member Author

lunny commented Mar 21, 2024

I do not think it needs to be backported. Becaseu 1.21 uses user_model.GetUserByID(db.DefaultContext, it won't be canceled.

But it may return other errors like temporary network problems between Gitea and database. Should the user be logout because of that reason?

@wxiaoguang wxiaoguang removed the lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged label Mar 21, 2024
@wxiaoguang
Copy link
Contributor

Then the title/description/comment don't match

@lunny lunny changed the title Fix the bug that user may logout if he switch pages too fast (#29962) Fix the bug that user may logout if GetUserByID return unknow error Mar 21, 2024
@lunny
Copy link
Member Author

lunny commented Mar 21, 2024

Then the title/description/comment don't match

Updated.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 21, 2024
@lunny lunny enabled auto-merge (squash) March 21, 2024 14:09
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 21, 2024
@lunny lunny merged commit c03b1e2 into go-gitea:release/v1.21 Mar 21, 2024
27 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 21, 2024
@lunny lunny deleted the lunny/fix_bug_wrongly_logout2 branch March 21, 2024 14:47
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jun 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants