-
Notifications
You must be signed in to change notification settings - Fork 3
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 preloaded pool size #19
Conversation
@bokobza Yeah, thanks for clarifying it in the original PR. This is the least intrusive change, but to make it completely nice, I suggest to introduce the def __init__(…, preload_pool_size=None, blocks_preload_pool_size=200):
self.blocks_preload_pool_size = blocks_preload_pool_size
# Legacy compatibility to avoid breaking changes
if preload_pool_size is not None:
self.blocks_preload_pool_size = preload_pool_size What do you think? @race-of-sloths invite |
@frol Thank you for calling! @bokobza Thank you for the contribution! Join Race of Sloths by simply mentioning me in your comment/PRs description and start collecting Sloth Points through contributions to open source projects. What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
I think it's better to do without the # Legacy compatibility to avoid breaking changes
if preload_pool_size is not None:
self.blocks_preload_pool_size = preload_pool_size Let me lay all the options out. With my changes:If a user was calling it like this: LakeConfig(
network=self.network,
start_block_height=starting_block_height,
aws_access_key_id=aws_access_key_id,
aws_secret_key=aws_secret_key
) the blocks pool size will be 200 as before, and if the user was calling it like this: LakeConfig(
network=self.network,
start_block_height=starting_block_height,
aws_access_key_id=aws_access_key_id,
aws_secret_key=aws_secret_key,
preload_pool_size=75
) the blocks pool size will become 75. IT's fixed, but if the user was relying on this working as it should and they're happy with the 200 blocks they're getting, then I agree this may introduce an unwelcomed change. With your change:If a user was calling it like this: LakeConfig(
network=self.network,
start_block_height=starting_block_height,
aws_access_key_id=aws_access_key_id,
aws_secret_key=aws_secret_key
) the blocks pool size will be 200 as before, and if the user was calling it like this: LakeConfig(
network=self.network,
start_block_height=starting_block_height,
aws_access_key_id=aws_access_key_id,
aws_secret_key=aws_secret_key,
preload_pool_size=75
) the blocks pool size will become 75, which is exactly the same as my change. So in a nutshell, it's exactly the same, the only difference is that with your changes, we end up with 2 similar parameters. better solutiondef __init__(…, preload_pool_size=None, blocks_preload_pool_size=200):
self.blocks_preload_pool_size = blocks_preload_pool_size
... with this changes: LakeConfig(
network=self.network,
start_block_height=starting_block_height,
aws_access_key_id=aws_access_key_id,
aws_secret_key=aws_secret_key
) the blocks pool size will be 200 as before, and if the user was calling it like this: LakeConfig(
network=self.network,
start_block_height=starting_block_height,
aws_access_key_id=aws_access_key_id,
aws_secret_key=aws_secret_key,
preload_pool_size=75
) the blocks pool size will still be 200, like it was before. LakeConfig(
network=self.network,
start_block_height=starting_block_height,
aws_access_key_id=aws_access_key_id,
aws_secret_key=aws_secret_key,
preload_pool_size=75,
blocks_preload_pool_size= 100
) |
@bokobza should we then warn users at runtime that preload_pool_size is noop? |
We could add a warning log that says "The preload_pool_size argument is not used and will be deprecated in a future release. Use blocks_preload_pool_size instead." |
@frol @frolvanya I think this is ready for review now. |
@bokobza Thanks for your contribution! |
I've updated pypi package: https://pypi.org/project/near-lake-framework/0.1.2/ |
No description provided.