Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Too Many Open Files [6639] #79

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

muhammadali286
Copy link

No description provided.

@@ -1123,6 +1138,8 @@ def _make_request(self, page):
params = {'page': page, 'page_size': self.PAGE_SIZE}
response = self.api_client.get(self.partner.lms_url + '/api/v1/course_average_rating/', params=params)
response.raise_for_status()
self.api_client.close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should close the connection first and then call raise_for_status()

@@ -952,6 +965,8 @@ def _make_request(self, page):
settings.WORDPRESS_APP_AUTH_PASSWORD
)
response = requests.get(self.api_url, auth=auth, params=params)
self.api_client.close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since, we're not using the client here this will not help.
we can use a context manager over here:

with requests.get(self.api_url, auth=auth, params=params) as response:
    response.raise_for_status()
    return response.json()

@muhammadali286 muhammadali286 merged commit 9c8a150 into develop-koa Apr 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants