mmd-osm left a comment (openstreetmap/openstreetmap-website#6326)
Furthermore, prefetching member tags could be useful to avoid lots of small
queries that are currently slowing down the process. The following could be
called from the two new controllers:
```ruby
def prefetch_member_tags(feature)
members = feature.relation_members.map(&:member).compact
grouped_members = members.group_by(&:class)
{
Node => :node_tags,
Way => :way_tags,
Relation => :relation_tags
}.each do |klass, tag_assoc|
records = grouped_members[klass] || []
ActiveRecord::Associations::Preloader.new(
:records => records,
:associations => tag_assoc
).call
end
end
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6326#issuecomment-3195663524
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/6326/c3195663...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev