We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Improve performance for concurrency builds DB query
We start getting timeout when calling `/api/v2/builds/concurrent/` from builders to know `(limit_reached, concurrent, max_concurrent)` for a particular project.

We need to improve the queryset that works over the `Build` model because sometimes it takes ~4s or more. It usually takes ~200ms, so I guess this is because the project is/has subprojects/translations since in that case the query gets more complex.

This is the query we need to optimize,

https://github.com/readthedocs/readthedocs.org/blob/2e9cb8dd85c5f8a55ab085abe58082fe3f2c6799/readthedocs/builds/querysets.py#L129-L177

Sentry issues: https://sentry.io/organizations/read-the-docs/issues/1719520575/?project=148442&query=is%3Aunresolved&statsPeriod=14d

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `readthedocs/builds/querysets.py`
Content:
```
1 """Build and Version QuerySet classes."""
2 import logging
3 
4 from django.db import models
5 from django.db.models import Q
6 
7 from readthedocs.core.utils.extend import SettingsOverrideObject
8 from readthedocs.projects import constants
9 from readthedocs.projects.models import Project
10 
11 from .constants import BUILD_STATE_TRIGGERED, BUILD_STATE_FINISHED
12 
13 
14 log = logging.getLogger(__name__)
15 
16 
17 __all__ = ['VersionQuerySet', 'BuildQuerySet', 'RelatedBuildQuerySet']
18 
19 
20 class VersionQuerySetBase(models.QuerySet):
21 
22     """Versions take into account their own privacy_level setting."""
23 
24     use_for_related_fields = True
25 
26     def _add_user_repos(self, queryset, user):
27         if user.has_perm('builds.view_version'):
28             return self.all()
29         if user.is_authenticated:
30             projects_pk = user.projects.all().values_list('pk', flat=True)
31             user_queryset = self.filter(project__in=projects_pk)
32             queryset = user_queryset | queryset
33         return queryset
34 
35     def public(self, user=None, project=None, only_active=True,
36                include_hidden=True, only_built=False):
37         queryset = self.filter(privacy_level=constants.PUBLIC)
38         if user:
39             queryset = self._add_user_repos(queryset, user)
40         if project:
41             queryset = queryset.filter(project=project)
42         if only_active:
43             queryset = queryset.filter(active=True)
44         if only_built:
45             queryset = queryset.filter(built=True)
46         if not include_hidden:
47             queryset = queryset.filter(hidden=False)
48         return queryset.distinct()
49 
50     def protected(self, user=None, project=None, only_active=True):
51         queryset = self.filter(
52             privacy_level__in=[constants.PUBLIC, constants.PROTECTED],
53         )
54         if user:
55             queryset = self._add_user_repos(queryset, user)
56         if project:
57             queryset = queryset.filter(project=project)
58         if only_active:
59             queryset = queryset.filter(active=True)
60         return queryset.distinct()
61 
62     def private(self, user=None, project=None, only_active=True):
63         queryset = self.filter(privacy_level__in=[constants.PRIVATE])
64         if user:
65             queryset = self._add_user_repos(queryset, user)
66         if project:
67             queryset = queryset.filter(project=project)
68         if only_active:
69             queryset = queryset.filter(active=True)
70         return queryset.distinct()
71 
72     def api(self, user=None, detail=True):
73         if detail:
74             return self.public(user, only_active=False)
75 
76         queryset = self.none()
77         if user:
78             queryset = self._add_user_repos(queryset, user)
79         return queryset.distinct()
80 
81     def for_project(self, project):
82         """Return all versions for a project, including translations."""
83         return self.filter(
84             models.Q(project=project) |
85             models.Q(project__main_language_project=project),
86         )
87 
88 
89 class VersionQuerySet(SettingsOverrideObject):
90     _default_class = VersionQuerySetBase
91 
92 
93 class BuildQuerySetBase(models.QuerySet):
94 
95     """
96     Build objects that are privacy aware.
97 
98     i.e. they take into account the privacy of the Version that they relate to.
99     """
100 
101     use_for_related_fields = True
102 
103     def _add_user_repos(self, queryset, user=None):
104         if user.has_perm('builds.view_version'):
105             return self.all()
106         if user.is_authenticated:
107             projects_pk = user.projects.all().values_list('pk', flat=True)
108             user_queryset = self.filter(project__in=projects_pk)
109             queryset = user_queryset | queryset
110         return queryset
111 
112     def public(self, user=None, project=None):
113         queryset = self.filter(version__privacy_level=constants.PUBLIC)
114         if user:
115             queryset = self._add_user_repos(queryset, user)
116         if project:
117             queryset = queryset.filter(project=project)
118         return queryset.distinct()
119 
120     def api(self, user=None, detail=True):
121         if detail:
122             return self.public(user)
123 
124         queryset = self.none()
125         if user:
126             queryset = self._add_user_repos(queryset, user)
127         return queryset.distinct()
128 
129     def concurrent(self, project):
130         """
131         Check if the max build concurrency for this project was reached.
132 
133         - regular project: counts concurrent builds
134 
135         - translation: concurrent builds of all the translations + builds of main project
136 
137         .. note::
138 
139           If the project/translation belongs to an organization, we count all concurrent
140           builds for all the projects from the organization.
141 
142         :rtype: tuple
143         :returns: limit_reached, number of concurrent builds, number of max concurrent
144         """
145         limit_reached = False
146         query = Q(project__slug=project.slug)
147 
148         if project.main_language_project:
149             # Project is a translation, counts all builds of all the translations
150             query |= Q(project__main_language_project=project.main_language_project)
151             query |= Q(project__slug=project.main_language_project.slug)
152 
153         elif project.translations.exists():
154             # The project has translations, counts their builds as well
155             query |= Q(project__in=project.translations.all())
156 
157         # If the project belongs to an organization, count all the projects
158         # from this organization as well
159         organization = project.organizations.first()
160         if organization:
161             query |= Q(project__in=organization.projects.all())
162 
163         concurrent = (
164             self.filter(query)
165             .exclude(state__in=[BUILD_STATE_TRIGGERED, BUILD_STATE_FINISHED])
166         ).distinct().count()
167 
168         max_concurrent = Project.objects.max_concurrent_builds(project)
169         log.info(
170             'Concurrent builds. project=%s running=%s max=%s',
171             project.slug,
172             concurrent,
173             max_concurrent,
174         )
175         if concurrent >= max_concurrent:
176             limit_reached = True
177         return (limit_reached, concurrent, max_concurrent)
178 
179 
180 class BuildQuerySet(SettingsOverrideObject):
181     _default_class = BuildQuerySetBase
182 
183 
184 class RelatedBuildQuerySetBase(models.QuerySet):
185 
186     """For models with association to a project through :py:class:`Build`."""
187 
188     use_for_related_fields = True
189 
190     def _add_user_repos(self, queryset, user=None):
191         if user.has_perm('builds.view_version'):
192             return self.all()
193         if user.is_authenticated:
194             projects_pk = user.projects.all().values_list('pk', flat=True)
195             user_queryset = self.filter(build__project__in=projects_pk)
196             queryset = user_queryset | queryset
197         return queryset
198 
199     def public(self, user=None, project=None):
200         queryset = self.filter(build__version__privacy_level=constants.PUBLIC)
201         if user:
202             queryset = self._add_user_repos(queryset, user)
203         if project:
204             queryset = queryset.filter(build__project=project)
205         return queryset.distinct()
206 
207     def api(self, user=None):
208         return self.public(user)
209 
210 
211 class RelatedBuildQuerySet(SettingsOverrideObject):
212     _default_class = RelatedBuildQuerySetBase
213     _override_setting = 'RELATED_BUILD_MANAGER'
214
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/readthedocs/builds/querysets.py b/readthedocs/builds/querysets.py
--- a/readthedocs/builds/querysets.py
+++ b/readthedocs/builds/querysets.py
@@ -1,8 +1,10 @@
 """Build and Version QuerySet classes."""
+import datetime
 import logging
 
 from django.db import models
 from django.db.models import Q
+from django.utils import timezone
 
 from readthedocs.core.utils.extend import SettingsOverrideObject
 from readthedocs.projects import constants
@@ -143,7 +145,11 @@
         :returns: limit_reached, number of concurrent builds, number of max concurrent
         """
         limit_reached = False
-        query = Q(project__slug=project.slug)
+        query = Q(
+            project__slug=project.slug,
+            # Limit builds to 5 hours ago to speed up the query
+            date__gte=timezone.now() - datetime.timedelta(hours=5),
+        )
 
         if project.main_language_project:
             # Project is a translation, counts all builds of all the translations

{"golden_diff": "diff --git a/readthedocs/builds/querysets.py b/readthedocs/builds/querysets.py\n--- a/readthedocs/builds/querysets.py\n+++ b/readthedocs/builds/querysets.py\n@@ -1,8 +1,10 @@\n \"\"\"Build and Version QuerySet classes.\"\"\"\n+import datetime\n import logging\n \n from django.db import models\n from django.db.models import Q\n+from django.utils import timezone\n \n from readthedocs.core.utils.extend import SettingsOverrideObject\n from readthedocs.projects import constants\n@@ -143,7 +145,11 @@\n         :returns: limit_reached, number of concurrent builds, number of max concurrent\n         \"\"\"\n         limit_reached = False\n-        query = Q(project__slug=project.slug)\n+        query = Q(\n+            project__slug=project.slug,\n+            # Limit builds to 5 hours ago to speed up the query\n+            date__gte=timezone.now() - datetime.timedelta(hours=5),\n+        )\n \n         if project.main_language_project:\n             # Project is a translation, counts all builds of all the translations\n", "issue": "Improve performance for concurrency builds DB query\nWe start getting timeout when calling `/api/v2/builds/concurrent/` from builders to know `(limit_reached, concurrent, max_concurrent)` for a particular project.\r\n\r\nWe need to improve the queryset that works over the `Build` model because sometimes it takes ~4s or more. It usually takes ~200ms, so I guess this is because the project is/has subprojects/translations since in that case the query gets more complex.\r\n\r\nThis is the query we need to optimize,\r\n\r\nhttps://github.com/readthedocs/readthedocs.org/blob/2e9cb8dd85c5f8a55ab085abe58082fe3f2c6799/readthedocs/builds/querysets.py#L129-L177\r\n\r\nSentry issues: https://sentry.io/organizations/read-the-docs/issues/1719520575/?project=148442&query=is%3Aunresolved&statsPeriod=14d\n", "before_files": [{"content": "\"\"\"Build and Version QuerySet classes.\"\"\"\nimport logging\n\nfrom django.db import models\nfrom django.db.models import Q\n\nfrom readthedocs.core.utils.extend import SettingsOverrideObject\nfrom readthedocs.projects import constants\nfrom readthedocs.projects.models import Project\n\nfrom .constants import BUILD_STATE_TRIGGERED, BUILD_STATE_FINISHED\n\n\nlog = logging.getLogger(__name__)\n\n\n__all__ = ['VersionQuerySet', 'BuildQuerySet', 'RelatedBuildQuerySet']\n\n\nclass VersionQuerySetBase(models.QuerySet):\n\n    \"\"\"Versions take into account their own privacy_level setting.\"\"\"\n\n    use_for_related_fields = True\n\n    def _add_user_repos(self, queryset, user):\n        if user.has_perm('builds.view_version'):\n            return self.all()\n        if user.is_authenticated:\n            projects_pk = user.projects.all().values_list('pk', flat=True)\n            user_queryset = self.filter(project__in=projects_pk)\n            queryset = user_queryset | queryset\n        return queryset\n\n    def public(self, user=None, project=None, only_active=True,\n               include_hidden=True, only_built=False):\n        queryset = self.filter(privacy_level=constants.PUBLIC)\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        if only_active:\n            queryset = queryset.filter(active=True)\n        if only_built:\n            queryset = queryset.filter(built=True)\n        if not include_hidden:\n            queryset = queryset.filter(hidden=False)\n        return queryset.distinct()\n\n    def protected(self, user=None, project=None, only_active=True):\n        queryset = self.filter(\n            privacy_level__in=[constants.PUBLIC, constants.PROTECTED],\n        )\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        if only_active:\n            queryset = queryset.filter(active=True)\n        return queryset.distinct()\n\n    def private(self, user=None, project=None, only_active=True):\n        queryset = self.filter(privacy_level__in=[constants.PRIVATE])\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        if only_active:\n            queryset = queryset.filter(active=True)\n        return queryset.distinct()\n\n    def api(self, user=None, detail=True):\n        if detail:\n            return self.public(user, only_active=False)\n\n        queryset = self.none()\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        return queryset.distinct()\n\n    def for_project(self, project):\n        \"\"\"Return all versions for a project, including translations.\"\"\"\n        return self.filter(\n            models.Q(project=project) |\n            models.Q(project__main_language_project=project),\n        )\n\n\nclass VersionQuerySet(SettingsOverrideObject):\n    _default_class = VersionQuerySetBase\n\n\nclass BuildQuerySetBase(models.QuerySet):\n\n    \"\"\"\n    Build objects that are privacy aware.\n\n    i.e. they take into account the privacy of the Version that they relate to.\n    \"\"\"\n\n    use_for_related_fields = True\n\n    def _add_user_repos(self, queryset, user=None):\n        if user.has_perm('builds.view_version'):\n            return self.all()\n        if user.is_authenticated:\n            projects_pk = user.projects.all().values_list('pk', flat=True)\n            user_queryset = self.filter(project__in=projects_pk)\n            queryset = user_queryset | queryset\n        return queryset\n\n    def public(self, user=None, project=None):\n        queryset = self.filter(version__privacy_level=constants.PUBLIC)\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        return queryset.distinct()\n\n    def api(self, user=None, detail=True):\n        if detail:\n            return self.public(user)\n\n        queryset = self.none()\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        return queryset.distinct()\n\n    def concurrent(self, project):\n        \"\"\"\n        Check if the max build concurrency for this project was reached.\n\n        - regular project: counts concurrent builds\n\n        - translation: concurrent builds of all the translations + builds of main project\n\n        .. note::\n\n          If the project/translation belongs to an organization, we count all concurrent\n          builds for all the projects from the organization.\n\n        :rtype: tuple\n        :returns: limit_reached, number of concurrent builds, number of max concurrent\n        \"\"\"\n        limit_reached = False\n        query = Q(project__slug=project.slug)\n\n        if project.main_language_project:\n            # Project is a translation, counts all builds of all the translations\n            query |= Q(project__main_language_project=project.main_language_project)\n            query |= Q(project__slug=project.main_language_project.slug)\n\n        elif project.translations.exists():\n            # The project has translations, counts their builds as well\n            query |= Q(project__in=project.translations.all())\n\n        # If the project belongs to an organization, count all the projects\n        # from this organization as well\n        organization = project.organizations.first()\n        if organization:\n            query |= Q(project__in=organization.projects.all())\n\n        concurrent = (\n            self.filter(query)\n            .exclude(state__in=[BUILD_STATE_TRIGGERED, BUILD_STATE_FINISHED])\n        ).distinct().count()\n\n        max_concurrent = Project.objects.max_concurrent_builds(project)\n        log.info(\n            'Concurrent builds. project=%s running=%s max=%s',\n            project.slug,\n            concurrent,\n            max_concurrent,\n        )\n        if concurrent >= max_concurrent:\n            limit_reached = True\n        return (limit_reached, concurrent, max_concurrent)\n\n\nclass BuildQuerySet(SettingsOverrideObject):\n    _default_class = BuildQuerySetBase\n\n\nclass RelatedBuildQuerySetBase(models.QuerySet):\n\n    \"\"\"For models with association to a project through :py:class:`Build`.\"\"\"\n\n    use_for_related_fields = True\n\n    def _add_user_repos(self, queryset, user=None):\n        if user.has_perm('builds.view_version'):\n            return self.all()\n        if user.is_authenticated:\n            projects_pk = user.projects.all().values_list('pk', flat=True)\n            user_queryset = self.filter(build__project__in=projects_pk)\n            queryset = user_queryset | queryset\n        return queryset\n\n    def public(self, user=None, project=None):\n        queryset = self.filter(build__version__privacy_level=constants.PUBLIC)\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(build__project=project)\n        return queryset.distinct()\n\n    def api(self, user=None):\n        return self.public(user)\n\n\nclass RelatedBuildQuerySet(SettingsOverrideObject):\n    _default_class = RelatedBuildQuerySetBase\n    _override_setting = 'RELATED_BUILD_MANAGER'\n", "path": "readthedocs/builds/querysets.py"}], "after_files": [{"content": "\"\"\"Build and Version QuerySet classes.\"\"\"\nimport datetime\nimport logging\n\nfrom django.db import models\nfrom django.db.models import Q\nfrom django.utils import timezone\n\nfrom readthedocs.core.utils.extend import SettingsOverrideObject\nfrom readthedocs.projects import constants\nfrom readthedocs.projects.models import Project\n\nfrom .constants import BUILD_STATE_TRIGGERED, BUILD_STATE_FINISHED\n\n\nlog = logging.getLogger(__name__)\n\n\n__all__ = ['VersionQuerySet', 'BuildQuerySet', 'RelatedBuildQuerySet']\n\n\nclass VersionQuerySetBase(models.QuerySet):\n\n    \"\"\"Versions take into account their own privacy_level setting.\"\"\"\n\n    use_for_related_fields = True\n\n    def _add_user_repos(self, queryset, user):\n        if user.has_perm('builds.view_version'):\n            return self.all()\n        if user.is_authenticated:\n            projects_pk = user.projects.all().values_list('pk', flat=True)\n            user_queryset = self.filter(project__in=projects_pk)\n            queryset = user_queryset | queryset\n        return queryset\n\n    def public(self, user=None, project=None, only_active=True,\n               include_hidden=True, only_built=False):\n        queryset = self.filter(privacy_level=constants.PUBLIC)\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        if only_active:\n            queryset = queryset.filter(active=True)\n        if only_built:\n            queryset = queryset.filter(built=True)\n        if not include_hidden:\n            queryset = queryset.filter(hidden=False)\n        return queryset.distinct()\n\n    def protected(self, user=None, project=None, only_active=True):\n        queryset = self.filter(\n            privacy_level__in=[constants.PUBLIC, constants.PROTECTED],\n        )\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        if only_active:\n            queryset = queryset.filter(active=True)\n        return queryset.distinct()\n\n    def private(self, user=None, project=None, only_active=True):\n        queryset = self.filter(privacy_level__in=[constants.PRIVATE])\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        if only_active:\n            queryset = queryset.filter(active=True)\n        return queryset.distinct()\n\n    def api(self, user=None, detail=True):\n        if detail:\n            return self.public(user, only_active=False)\n\n        queryset = self.none()\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        return queryset.distinct()\n\n    def for_project(self, project):\n        \"\"\"Return all versions for a project, including translations.\"\"\"\n        return self.filter(\n            models.Q(project=project) |\n            models.Q(project__main_language_project=project),\n        )\n\n\nclass VersionQuerySet(SettingsOverrideObject):\n    _default_class = VersionQuerySetBase\n\n\nclass BuildQuerySetBase(models.QuerySet):\n\n    \"\"\"\n    Build objects that are privacy aware.\n\n    i.e. they take into account the privacy of the Version that they relate to.\n    \"\"\"\n\n    use_for_related_fields = True\n\n    def _add_user_repos(self, queryset, user=None):\n        if user.has_perm('builds.view_version'):\n            return self.all()\n        if user.is_authenticated:\n            projects_pk = user.projects.all().values_list('pk', flat=True)\n            user_queryset = self.filter(project__in=projects_pk)\n            queryset = user_queryset | queryset\n        return queryset\n\n    def public(self, user=None, project=None):\n        queryset = self.filter(version__privacy_level=constants.PUBLIC)\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(project=project)\n        return queryset.distinct()\n\n    def api(self, user=None, detail=True):\n        if detail:\n            return self.public(user)\n\n        queryset = self.none()\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        return queryset.distinct()\n\n    def concurrent(self, project):\n        \"\"\"\n        Check if the max build concurrency for this project was reached.\n\n        - regular project: counts concurrent builds\n\n        - translation: concurrent builds of all the translations + builds of main project\n\n        .. note::\n\n          If the project/translation belongs to an organization, we count all concurrent\n          builds for all the projects from the organization.\n\n        :rtype: tuple\n        :returns: limit_reached, number of concurrent builds, number of max concurrent\n        \"\"\"\n        limit_reached = False\n        query = Q(\n            project__slug=project.slug,\n            # Limit builds to 5 hours ago to speed up the query\n            date__gte=timezone.now() - datetime.timedelta(hours=5),\n        )\n\n        if project.main_language_project:\n            # Project is a translation, counts all builds of all the translations\n            query |= Q(project__main_language_project=project.main_language_project)\n            query |= Q(project__slug=project.main_language_project.slug)\n\n        elif project.translations.exists():\n            # The project has translations, counts their builds as well\n            query |= Q(project__in=project.translations.all())\n\n        # If the project belongs to an organization, count all the projects\n        # from this organization as well\n        organization = project.organizations.first()\n        if organization:\n            query |= Q(project__in=organization.projects.all())\n\n        concurrent = (\n            self.filter(query)\n            .exclude(state__in=[BUILD_STATE_TRIGGERED, BUILD_STATE_FINISHED])\n        ).distinct().count()\n\n        max_concurrent = Project.objects.max_concurrent_builds(project)\n        log.info(\n            'Concurrent builds. project=%s running=%s max=%s',\n            project.slug,\n            concurrent,\n            max_concurrent,\n        )\n        if concurrent >= max_concurrent:\n            limit_reached = True\n        return (limit_reached, concurrent, max_concurrent)\n\n\nclass BuildQuerySet(SettingsOverrideObject):\n    _default_class = BuildQuerySetBase\n\n\nclass RelatedBuildQuerySetBase(models.QuerySet):\n\n    \"\"\"For models with association to a project through :py:class:`Build`.\"\"\"\n\n    use_for_related_fields = True\n\n    def _add_user_repos(self, queryset, user=None):\n        if user.has_perm('builds.view_version'):\n            return self.all()\n        if user.is_authenticated:\n            projects_pk = user.projects.all().values_list('pk', flat=True)\n            user_queryset = self.filter(build__project__in=projects_pk)\n            queryset = user_queryset | queryset\n        return queryset\n\n    def public(self, user=None, project=None):\n        queryset = self.filter(build__version__privacy_level=constants.PUBLIC)\n        if user:\n            queryset = self._add_user_repos(queryset, user)\n        if project:\n            queryset = queryset.filter(build__project=project)\n        return queryset.distinct()\n\n    def api(self, user=None):\n        return self.public(user)\n\n\nclass RelatedBuildQuerySet(SettingsOverrideObject):\n    _default_class = RelatedBuildQuerySetBase\n    _override_setting = 'RELATED_BUILD_MANAGER'\n", "path": "readthedocs/builds/querysets.py"}]}