refactor: Merge Apify RQ storage clients into one class#643
Closed
refactor: Merge Apify RQ storage clients into one class#643
Conversation
Contributor
|
I'll leave the review to @Pijukatel as the author of the current thing. My two cents are that I like the simplicity of a single class, but IIRC there are some instance attributes that are only accessed by one of the two implementations, which makes thing kinda awkward. |
Contributor
|
I also considered this approach initially, but I did not think it was a good one for the following reasons:
|
2eae5b1 to
2f8ce00
Compare
Contributor
Author
|
Closing in favor of #695. |
vdusek
added a commit
that referenced
this pull request
Dec 2, 2025
Follow-up to #643. It does not merge the clients. It only: - eliminates duplicated docstrings, - improves several docstrings, - fixes method ordering.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I didn't have an opportunity to provide feedback on #573 as it was merged while I was on vacation. While the implementation works well and the costs and performance improvements in
singlemode are great (good job @Pijukatel), I have concerns about the current architecture...IMO, we already have quite a lot of storage client classes: base classes with docstrings, the "storage client openers" for each backend type, and the individual storage clients for all storage types. By introducing the split into
singleandsharedmodes, we've added yet another layer to the Apify RQ storage client. Also, it implements the RQ storage client base class interface, but only partially. Altogether, this negatively affects readability, maintainability, and debuggability (I ran into this while investigating the truncated unique keys issue), and it increases code duplication (e.g., identical docstrings repeated in multiple places).This PR merges the three request queue client classes (
ApifyRequestQueueClient,ApifyRequestQueueSingleClient,ApifyRequestQueueSharedClient) into a singleApifyRequestQueueClientclass. Methods now use conditional logic based on the access parameter to determine whether to call_method_single()or_method_shared()variants.This change reduces the total lines of code, removes one layer of storage clients, eliminates docstring duplication, and all existing tests are passing.
Let me know what you think.