Skip to content

Commit 98755fd

Browse files
authored
Merge pull request #6865 from readthedocs/dont-do-extra-query
Don't do extra query if the project is a translation
2 parents b72343f + a92ed39 commit 98755fd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

readthedocs/core/resolver.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,18 @@ def _get_canonical_project(self, project, projects=None):
219219
# recursion. We can't determine a root project well here, so you get
220220
# what you get if you have configured your project in a strange manner
221221
if projects is None:
222-
projects = [project]
222+
projects = {project}
223223
else:
224-
projects.append(project)
224+
projects.add(project)
225225

226226
next_project = None
227-
relation = project.get_parent_relationship()
228227
if project.main_language_project:
229228
next_project = project.main_language_project
230-
elif relation:
231-
next_project = relation.parent
229+
else:
230+
relation = project.get_parent_relationship()
231+
if relation:
232+
next_project = relation.parent
233+
232234
if next_project and next_project not in projects:
233235
return self._get_canonical_project(next_project, projects)
234236
return project

0 commit comments

Comments
 (0)