-
Notifications
You must be signed in to change notification settings - Fork 6
Add specific timeouts per request per #25 #96
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
I've added timeouts per what is outlined in #25. The issue requests the addition of a timeout to the This method creates an |
Thanks @PhillSimonds, really appreciate the help with this PR
Yes this is the expected behavior for obj = self.client.create(kind="BuiltinTag", name="Blue")
obj.save() we should probably change the name for something more explicit One of the main benefit of this approach is that we can use a batch to execute all the API calls in parallel batch = await client.create_batch()
for tag in ["red", "green", "blue", "yellow", "orange"]:
obj = client.create(kind="BuiltinTag", name=tag)
batch.add(task=client.save)
async for obj, result in batch.execute():
print(f"Tag {obj.name.value} created") Having said that I totally see your point that someone might expect |
Might be that the name is misleading and it should be |
Personally I like the workflow the way it is, ie you create the node in memory and then save it. That being said, I understand the point. device = client.create(InfraDevice, name="my device", save=True) But then we might as well add an argument that allows you to pass in a batch, to add the save action to a batch instead. batch = client.create_batch()
device = client.create(InfraDevice, name="my device", save_with_batch=batch) An alternative could be to rename the |
Happy to help! Thanks for the clarifications :) |
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 Phillip!
This PR adds specific timeouts per request to the InfrahubClient and InfrahubNode objects per issue #25.
fixes #25