-
Notifications
You must be signed in to change notification settings - Fork 488
feat: implement _snapshot_client
for Snapshotter
#957
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
client = service_locator.get_storage_client() | ||
|
||
error_count = 0 | ||
rate_limit_errors: dict[int, int] = getattr(client, 'rate_limit_errors', {}) |
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 need some explanation here... What values can be in rate_limit_errors
? What value is going to be there for the MemoryStorageClient
(nothing?) and for the ApifyStorageClient
? Thanks.
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.
For MemoryStorageClient
it is empty dict
. Since getattr
will return the default value if the specified attribute does not exist
For ApifyStorageClient
it is rate_limit_errors
from https://github.com/apify/apify-client-python/blob/master/src/apify_client/_statistics.py#L15. Relate PR - apify/apify-sdk-python#387
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 came here from apify/apify-sdk-python#387. I'd much prefer to add another method to the storage client interface, along with a dummy implementation (return {}
) on the memory storage client.
Then we can avoid the getattr
here, which is pretty confusing and non-standard.
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 have some concerns/questions.
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.
Thanks for the explanation.
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.
Apart from that one comment, I'm also not sure that this passes as a chore:
🙂
client = service_locator.get_storage_client() | ||
|
||
error_count = 0 | ||
rate_limit_errors: dict[int, int] = getattr(client, 'rate_limit_errors', {}) |
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 came here from apify/apify-sdk-python#387. I'd much prefer to add another method to the storage client interface, along with a dummy implementation (return {}
) on the memory storage client.
Then we can avoid the getattr
here, which is pretty confusing and non-standard.
I'm not sure about the On the one side, it has no effect on clients outside of the Apify platform. On the other side, we now add a new method to the public interface.... |
I mean, we're still on 0.x, so I wouldn't think twice about making it a |
_snapshot_client
for Snapshotter
_snapshot_client
for Snapshotter
Description
_snapshot_client
forSnapshotter
Issues
Snapshotter._snapshot_client()
#60