Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Link and announcement indexes query DB a lot #73

Open
kailan opened this issue Oct 15, 2017 · 6 comments
Open

Link and announcement indexes query DB a lot #73

kailan opened this issue Oct 15, 2017 · 6 comments
Labels

Comments

@kailan
Copy link
Contributor

kailan commented Oct 15, 2017

screen shot 2017-10-15 at 13 43 39

@kailan kailan added the bug label Oct 15, 2017
@kailan
Copy link
Contributor Author

kailan commented Feb 11, 2018

Caused by permission checks querying for the announceable/linkable of each entry.

@ghost
Copy link

ghost commented Mar 1, 2018

Is there really all that much that can be done about this without creating security issues around permissions?

@kailan
Copy link
Contributor Author

kailan commented Mar 1, 2018

@gxrneyme Unfortunately our ORM doesn't support the kind of query we need to be able to fix this, so this is kind of an on-hold issue until it does (or we implement it ourselves).

@ghost
Copy link

ghost commented Mar 1, 2018

What were you thinking in terms of queries, @kailan?

@kailan
Copy link
Contributor Author

kailan commented Mar 1, 2018

@gxrneyme When fetching the announcements/links, we need to add include(:announceable), include(:linkable) to the query to also fetch the place that the announcement/link was posted in.
Unfortunately we can't do that, since Mongoid doesn't support the pre-fetching of polymorphic associations.

This could be mitigated for certain views such as departments/activities by only running the permission check once (instead of for each link) since we know that the results are all the same.

@ghost
Copy link

ghost commented Mar 1, 2018

@kailan Good thinking on the departments/activities front — would likely speed things up a lot. Will take a look sometime and see if I can put you a PR together.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

1 participant