-
Notifications
You must be signed in to change notification settings - Fork 75
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
feat: add retry/timeout to manual surface #222
Conversation
1b61f49
to
e7d2119
Compare
07aa854
to
16a1e34
Compare
Methods include: - 'create' - 'set' - 'update' - 'delete' - 'get' - 'collections' Toward #221
d6e76d6
to
4e3be50
Compare
Updated: I just reviewed it as a whole, and think it is easier than following the commit-by-commit path. |
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.
Comments on commit-by-commit review reflecting later changes as the PR evolved.
google/cloud/firestore_v1/client.py
Outdated
if timeout is not None: | ||
kwargs["timeout"] = timeout | ||
|
||
return kwargs |
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.
Later commits factor this method out into _helpers.make_retry_timeout_kwargs
.
retry=retry, | ||
timeout=timeout, | ||
metadata=client._rpc_metadata, | ||
) |
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.
40fae96 removes most of the redundancy in the tests for Client.get_all
.
timeout=timeout, | ||
metadata=client._rpc_metadata, | ||
) | ||
|
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.
bad75e1 factors out the redundancy in the tests for Client.collections
.
google/cloud/firestore_v1/batch.py
Outdated
kwargs["retry"] = retry | ||
|
||
if timeout is not None: | ||
kwargs["timeout"] = timeout |
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.
Since factored out to use _helpers.make_retry_timeout_kwargs
.
tests/unit/v1/test_batch.py
Outdated
kwargs["retry"] = retry | ||
|
||
if timeout is not None: | ||
kwargs["timeout"] = timeout |
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.
Likewise, later commits update to use the helper here.
tests/unit/v1/test_transaction.py
Outdated
kwargs["retry"] = retry | ||
|
||
if timeout is not None: | ||
kwargs["timeout"] = timeout |
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.
Factored out later to use the helper.
tests/unit/v1/test_client.py
Outdated
kwargs["retry"] = retry | ||
|
||
if timeout is not None: | ||
kwargs["timeout"] = timeout |
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.
Factored out later to use the helper.
tests/unit/v1/test_async_client.py
Outdated
kwargs["retry"] = retry | ||
|
||
if timeout is not None: | ||
kwargs["timeout"] = timeout |
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.
Factored out later to use the helper.
) | ||
|
||
while True: | ||
for i in iterator.collection_ids: | ||
yield self.collection(i) | ||
if iterator.next_page_token: | ||
next_request = request.cpoy() |
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.
Typo fixed in 9b4707a
) | ||
|
||
while True: | ||
for i in iterator.collection_ids: | ||
yield self.collection(i) | ||
if iterator.next_page_token: | ||
next_request = request.cpoy() |
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.
Typo fixed in 1acbde3
iterator = _Iterator(pages=[collection_ids]) | ||
firestore_api.list_collection_ids.return_value = iterator | ||
|
||
collections = [c async for c in client.collections()] | ||
collections = [c async for c in client.collections(**kwargs)] |
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.
just confirming, you have added these changes to a few tests to get complete coverage? The changes of this PR shouldn't result in any required changes to users correct?
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.
Right. See test_collections
and test_collections_w_retry_timeout
below.
Allows user to pass explicit 'retry=None' to suppress retries.
Base Classes
base_client.BaseClient.collections
(signature only)base_client.BaseClient.get_all
(signature only)base_collection.BaseCollectionReference.add
(signature only)base_collection.BaseCollectionReference.get
(signature only)base_collection.BaseCollectionReference.list_documents
(signature only)base_collection.BaseCollectionReference.stream
(signature only)base_document.BaseDocumentReference.collections
(signature only)base_document.BaseDocumentReference.create
(signature only)base_document.BaseDocumentReference.delete
(signature only)base_document.BaseDocumentReference.get
(signature only)base_document.BaseDocumentReference.set
(signature only)base_document.BaseDocumentReference.update
(signature only)base_query.BaseCollectionGroup.get_partitions
(signature only)base_query.BaseQuery.get
(signature only)base_query.BaseQuery.stream
(signature only)base_transaction.BaseTransaction.get
(signature only)base_transaction.BaseTransaction.get_all
(signature only)Synchronous
batch.Batch.commit
client.Client.collections
client.Client.get_all
collection.Collection.add
collection.Collection.get
collection.Collection.list_documents
collection.Collection.stream
document.Document.collections
document.Document.create
document.Document.delete
document.Document.get
document.Document.set
document.Document.update
query.CollectionGroup.get_partitions
query.Query.get
query.Query.stream
transaction.Transaction.get
transaction.Transaction.get_all
Asynchronous
async_batch.AsyncBatch.commit
async_client.AsyncClient.collections
async_client.AsyncClient.get_all
async_collection.AsyncCollection.add
async_collection.AsyncCollection.get
async_collection.AsyncCollection.list_documents
async_collection.AsyncCollection.stream
async_document.AsyncDocument.collections
async_document.AsyncDocument.create
async_document.AsyncDocument.delete
async_document.AsyncDocument.get
async_document.AsyncDocument.set
async_document.AsyncDocument.update
async_query.AsyncCollectionGroup.get_partitions
async_query.AsyncQuery.get
async_query.AsyncQuery.stream
async_transaction.AsyncTransaction.get
async_transaction.AsyncTransaction.get_all
Unsure
base_collection.BaseCollection.on_snapshot
(signature only)base_document.BaseDocumentRef.on_snapshot
(signature only)base_query.BaseQuery.on_snapshot
(signature only)collection.Collection.on_snapshot
document.Document.on_snapshot
query.Query.on_snapshot
watch.Watch.__init__
watch.Watch.for_document
watch.Watch.for_query
Closes #221