Locations Plugin

Thanks @merefield that’s exactly what we had tried :slight_smile:

Alas, it still pauses to load the User List page first, then it redirects to the map.

I was hoping just the map might be available on /map or something :slight_smile:

2 Likes

Gotcha.

But it’s a red herring.

The vanilla User List is cached so it loads in a split second. The issue is the length of time it takes to load the model for the map, which in your case is ~400 users in one go … so yeah, the User List rendering is wasting 0.1% of the processing time, but the real problem is the latter part. There may be no quick solution to that.

I know this partly because I just deployed to a site which hasn’t used this facility previously. The map data loads so quickly that User List is never visible (despite it loading first). The rub? Only 2 users have so far pinned their location … the User Map doesn’t scale well with its current architecture.

3 Likes

Interesting insight, thanks.

We only have around 12% of our community members on the map at the moment and we were recently discussing a drive to get more members on there.

Would I be right in thinking that as our community continues to grow, we can expect the map loading to get slower and slower?

2 Likes

I’m guessing too that it has to load the user list first?

Knowing nothing about the code, is it possible to just have the map on it’s own somewhere? :thinking: :man_shrugging:

2 Likes

Like I said, that’s irrelevant. The user list is cached and very short.

2 Likes

Does the Locations plugin use its own model for this or an existing core one? I’m wondering where the bottleneck in selecting just 400 rows of user information from the database is?

Sorry for all the questions @merefield just trying to better understand how it works under the hood :slight_smile:

2 Likes

No problem Richie. We override the DirectoryItemsController to pull back more people in one go than would normally occur when the data is paged for the normal table. The model is no different.

This really needs a root and branch replacement with a much more complex data streaming system that is aware of the viewport size and location. That’s quite a lot of work I suspect. Not least because that will no longer be able to leverage as much of the code that comes with Discourse, it’s a completely different use case. Quite an interesting piece of work though!

The fact that you are seeing this delay every single time suggests its not caching, and that could be something we might be able to fix without massive changes.

4 Likes

I haven’t missed or changed a simple Discourse setting have I?? :man_facepalming:

2 Likes

No, it’s not your issue, except that you may have outgrown the current capabilities of the plugin :slight_smile:

When I get chance, I’ll look into what it might take to cache the results so you will only experience that issue once per session. That’s the low hanging fruit.

The bigger tree surgery however …

2 Likes

:cry:

Thanks @merefield but hang fire on that one. I have no evidence either way but my suspicion would strongly be that people only ever look at the map once per session anyway :thinking:

2 Likes

A bug report.

This bug has been around for a while, but I finally figured out the locations plugin is to blame. When I have the plugin disabled, my website shows up correctly on the user card, but when I enable it, it shows up twice! Here’s a screenshot from the user card that appears on hover:

and another from the fully expanded profile page:

I have tested this many times by playing with combinations of changing the values in the profile. The only time I see it appear correctly, that is the website shows only once is if I disable the Locations plugin.

2 Likes

Thanks Kartik, are you on a recent update?

2 Likes

Yes, I should have mentioned it.


EDIT: The HTML generated for the duplicate element:

<span id="ember858" class="ember-view">  <div id="ember860" class="user-location-and-website-outlet replace-location ember-view"><!----><div class="user-profile-website">
  <svg class="fa d-icon d-icon-globe svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#globe"></use></svg>
    <span title="http://ks.cs.uchicago.edu">ks.cs.uchicago.edu</span>
</div>
</div>
</span>
3 Likes

I’m tied up with client work atm, but will keep this one in mind in the run up to the next supported upgrade period (1-5th of next month).

2 Likes

Interesting that one is styled as a clickable link and the other is not :thinking:

Also interesting that we’re not seeing this issue on our forum.

2 Likes

We seem to have another issue @merefield

Our user map is currently showing 472 users, but a few users have reported that their pin is not showing on the map. Yet when you view their user card, they are showing on their own little map.

When we run a query on the database for users with a location added, we get 492 results, so it looks like 20 or so are not visible on the map.

Can we do anything to help debug this one?

Viewing Chris’ user card, he displays on his own map profile ok:

Full / main map, Chris is missing :thinking:

1 Like

What’s the value of this setting, Richie?

image

for the example missing user, can you please PM me the result of this from the rails console:

myuser = User.find_by(username: "===USERNAME===")
myuser.custom_fields["geo_location"]
2 Likes

The plot thickens :smiley:

It was set to 500.

I changed it to 1000 and our missing people instantly appeared :thinking:

I’ll PM you the results as requested :+1:t2:

2 Likes

Ah, in which case there is no need to PM that information. I suspect that the list of people with geo_locations might have included ones with blanks there (custom field exists but empty object for example) and as a result you might be tripping the max number. Increase the max number and even though there are blanks, they don’t push out the valid users. Definitely could improve the code there, but not critical.

2 Likes

Thanks @merefield we have seen a couple of users with things like '{}' in their value so I’m guessing they may once had a location and it’s since been removed.

I also can’t remember if those values get deleted when a user is anonymised - again it would trip us over the magic 500 value that we had set.

Cheers :slight_smile:

2 Likes