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 unnecessary SQL query performed on unauthenticated requests #11179

Merged
merged 1 commit into from Jun 25, 2019

Conversation

@Gargron
Copy link
Member

commented Jun 25, 2019

No description provided.

@Gargron Gargron added the performance label Jun 25, 2019
@Gargron Gargron force-pushed the fix-extra-session-query branch from 344983c to ec34f83 Jun 25, 2019
@ykzts
ykzts approved these changes Jun 25, 2019
@Gargron Gargron merged commit 6836587 into master Jun 25, 2019
2 checks passed
2 checks passed
build-and-test Workflow: build-and-test
Details
codeclimate All good!
Details
@Gargron Gargron deleted the fix-extra-session-query branch Jun 25, 2019
end

def current_session
@current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id'])
return @current_session if defined?(@current_session)

This comment has been minimized.

Copy link
@nightpool

nightpool Jun 26, 2019

Collaborator

why if defined? rather then ||=? shouldn't they be equivalent?

This comment has been minimized.

Copy link
@Gargron

Gargron Jun 26, 2019

Author Member

||= gets re-run if the previous value is nil, such as when the session was not found

hiyuki2578 added a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
hiyuki2578 added a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.