Skip to content

Conversation

Mantisus
Copy link
Collaborator

@Mantisus Mantisus commented Feb 4, 2025

Description

  • implement _snapshot_client for Snapshotter

Issues

@Mantisus Mantisus requested a review from vdusek February 4, 2025 21:51
@Mantisus Mantisus self-assigned this Feb 6, 2025
vdusek

This comment was marked as outdated.

@vdusek vdusek requested review from janbuchar and vdusek February 6, 2025 13:13
client = service_locator.get_storage_client()

error_count = 0
rate_limit_errors: dict[int, int] = getattr(client, 'rate_limit_errors', {})
Copy link
Collaborator

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.

Copy link
Collaborator Author

@Mantisus Mantisus Feb 6, 2025

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

Copy link
Collaborator

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.

@vdusek vdusek self-requested a review February 6, 2025 13:19
Copy link
Collaborator

@vdusek vdusek left a 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.

@Mantisus Mantisus requested a review from vdusek February 6, 2025 13:46
Copy link
Collaborator

@vdusek vdusek left a 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.

Copy link
Collaborator

@janbuchar janbuchar left a 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', {})
Copy link
Collaborator

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.

@Mantisus
Copy link
Collaborator Author

Mantisus commented Feb 7, 2025

Apart from that one comment, I'm also not sure that this passes as a chore: 🙂

I'm not sure about the chore type either.

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....

@Mantisus Mantisus requested a review from janbuchar February 7, 2025 16:42
@janbuchar
Copy link
Collaborator

Apart from that one comment, I'm also not sure that this passes as a chore: 🙂

I'm not sure about the chore type either.

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 feat 🙂 Let's edit that and merge!

@Mantisus Mantisus changed the title chore: implement _snapshot_client for Snapshotter feat: implement _snapshot_client for Snapshotter Feb 10, 2025
@vdusek vdusek merged commit ba4d384 into apify:master Feb 11, 2025
22 of 24 checks 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.

Implement Snapshotter._snapshot_client()
3 participants