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

Reduced response time in nearby People search API #9940

Merged
merged 2 commits into from
Jul 27, 2021

Conversation

17sushmita
Copy link
Member

@17sushmita 17sushmita commented Jul 22, 2021

Fixes #7556

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in a uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

Before -

GET: https://publiclab.org/api/srch/nearbyPeople?nwlat=10.0&selat=0.0&nwlng=0.0&selng=10.0
Time: 39.36
image

After -

GET: https://unstable.publiclab.org/api/srch/nearbyPeople?nwlat=10.0&selat=0.0&nwlng=0.0&selng=10.0
Time : 2.12s
image

@gitpod-io
Copy link

gitpod-io bot commented Jul 22, 2021

@daemon1024
Copy link
Member

Wow 👀 So we don't need to deal with n+1 problem at all?

@codeclimate
Copy link

codeclimate bot commented Jul 22, 2021

Code Climate has analyzed commit ccb5e78 and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #9940 (ccb5e78) into main (b73594f) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9940      +/-   ##
==========================================
- Coverage   82.13%   82.13%   -0.01%     
==========================================
  Files          98       98              
  Lines        5968     5966       -2     
==========================================
- Hits         4902     4900       -2     
  Misses       1066     1066              
Impacted Files Coverage Δ
app/services/search_service.rb 95.00% <100.00%> (-0.10%) ⬇️

@17sushmita
Copy link
Member Author

Wow So we don't need to deal with n+1 problem at all?

Ah! I didn't see the discussion on the main issue. Let's think of improving the performance furthermore. Currently looping over every node by the user to check if it has location: blurred was really slow so this can be simply improved by using a rails query.

@daemon1024
Copy link
Member

Yeah we need to analyse further but in my opinion maybe we should proceed with merging this, since this is a significant improvement ( Significant as in Huge :O ) Can work on others in subsequent PRs as we proceed with discussion at #7556

@17sushmita 17sushmita marked this pull request as ready for review July 23, 2021 17:00
user_tag.name == "location:blurred"
end
end
items = items.where('user_tags.value <> "location:blurred"')
Copy link
Member

Choose a reason for hiding this comment

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

awesomeeeee

@jywarren jywarren merged commit 40b8c78 into publiclab:main Jul 27, 2021
@jywarren
Copy link
Member

Very excited for this!

@17sushmita 17sushmita mentioned this pull request Aug 17, 2021
5 tasks
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
* reduced response time in nearby People search api

* reformatted previous commit
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
* reduced response time in nearby People search api

* reformatted previous commit
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.

Research why loading nearbyPeople Srch API is so slow to load
3 participants