Skip to content

Commit

Permalink
feat: Get active courses from lms for lms data loading (#3755)
Browse files Browse the repository at this point in the history
  • Loading branch information
DawoudSheraz authored Jan 10, 2023
1 parent 214efdc commit a9192a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions course_discovery/apps/course_metadata/data_loaders/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _load_data(self, page): # pragma: no cover
response = self._make_request(page)
self._process_response(response)

# The courses endpoint has a 40 requests/minute rate limit.
# The courses endpoint has 40 requests/minute rate limit.
# This will back off at a rate of 60/120/240 seconds (from the factor 60 and default value of base 2).
# This backoff code can still fail because of the concurrent requests all requesting at the same time.
# So even in the case of entering into the next minute, if we still exceed our limit for that min,
Expand All @@ -93,7 +93,7 @@ def _load_data(self, page): # pragma: no cover
)
def _make_request(self, page):
logger.info('Requesting course run page %d...', page)
params = {'page': page, 'page_size': self.PAGE_SIZE, 'username': self.username}
params = {'page': page, 'page_size': self.PAGE_SIZE, 'username': self.username, 'active_only': True}
response = self.api_client.get(self.api_url + '/courses/', params=params)
response.raise_for_status()
return response.json()
Expand Down

0 comments on commit a9192a5

Please sign in to comment.