-
Notifications
You must be signed in to change notification settings - Fork 15
fix: Cache requests in RQ implementations by id
#633
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
Conversation
288e0b3
to
d3dab06
Compare
d3dab06
to
922a4c8
Compare
59a33b1
to
4209d75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few comments
src/apify/storage_clients/_apify/_request_queue_shared_client.py
Outdated
Show resolved
Hide resolved
src/apify/storage_clients/_apify/_request_queue_shared_client.py
Outdated
Show resolved
Hide resolved
response = await self._api_client.get_request(unique_key_to_request_id(unique_key)) | ||
return await self._get_request_by_id(unique_key_to_request_id(unique_key)) | ||
|
||
async def _get_request_by_id(self, request_id: str) -> Request | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods order please (https://pypi.org/project/flake8-class-attributes-order/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am reluctant to follow a formatting rule that is not enforced automatically by a tool. We do not even have a coding style defined, so how does one know what rule to follow? The code base is not compliant with the rule anyway. Cherry picking it randomly in some PR's is just annoying.
I will be happy to follow the rule as long as it is enforced by a tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, not gonna force you. I'm not familiar with this functionality in VS Code, but anyway, you can't do it in GitHub - the point is that with proper ordering, the public interface is clearer and the whole class more readable. And what bothers me the most is the chaotic alternation between private and public methods.
src/apify/storage_clients/_apify/_request_queue_shared_client.py
Outdated
Show resolved
Hide resolved
src/apify/storage_clients/_apify/_request_queue_single_client.py
Outdated
Show resolved
Hide resolved
return self._requests_cache[unique_key] | ||
return await self._get_request(id=unique_key_to_request_id(unique_key)) | ||
|
||
async def _get_request(self, id: str) -> Request | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods order please (https://pypi.org/project/flake8-class-attributes-order/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you noticed the failing integration tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate the chaotic alternation between private and public methods; otherwise LGTM.
Description
id
instead ofunique_key
due to the Apify platform truncating long unique_keys.Issues
list_head
method returns truncated unique keys and URLs for long URLs #630Testing