From d8b90fb519707281e04a1d26a312543f7adb1050 Mon Sep 17 00:00:00 2001 From: Chris Wilcox Date: Tue, 17 Dec 2019 21:23:13 -0800 Subject: [PATCH 1/3] fix: Recover watch stream on more error types --- firestore/google/cloud/firestore_v1/watch.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/firestore/google/cloud/firestore_v1/watch.py b/firestore/google/cloud/firestore_v1/watch.py index 458a3a94780f..e1d95544d5be 100644 --- a/firestore/google/cloud/firestore_v1/watch.py +++ b/firestore/google/cloud/firestore_v1/watch.py @@ -57,7 +57,14 @@ "DO_NOT_USE": -1, } _RPC_ERROR_THREAD_NAME = "Thread-OnRpcTerminated" -_RECOVERABLE_STREAM_EXCEPTIONS = (exceptions.ServiceUnavailable,) +_RECOVERABLE_STREAM_EXCEPTIONS = ( + exceptions.Unknown, + exceptions.DeadlineExceeded, + exceptions.ResourceExhausted, + exceptions.InternalServerError, + exceptions.ServiceUnavailable, + exceptions.Unauthenticated, +) _TERMINATING_STREAM_EXCEPTIONS = (exceptions.Cancelled,) DocTreeEntry = collections.namedtuple("DocTreeEntry", ["value", "index"]) From 88d87b62124b5d8c467b0e378768bf0f7d4cb784 Mon Sep 17 00:00:00 2001 From: Chris Wilcox Date: Wed, 18 Dec 2019 10:55:34 -0800 Subject: [PATCH 2/3] fix: don't retry deadline exceeded --- firestore/google/cloud/firestore_v1/watch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/firestore/google/cloud/firestore_v1/watch.py b/firestore/google/cloud/firestore_v1/watch.py index e1d95544d5be..10c5953a17f0 100644 --- a/firestore/google/cloud/firestore_v1/watch.py +++ b/firestore/google/cloud/firestore_v1/watch.py @@ -59,7 +59,6 @@ _RPC_ERROR_THREAD_NAME = "Thread-OnRpcTerminated" _RECOVERABLE_STREAM_EXCEPTIONS = ( exceptions.Unknown, - exceptions.DeadlineExceeded, exceptions.ResourceExhausted, exceptions.InternalServerError, exceptions.ServiceUnavailable, From e2ff2345a4cb118e0b907ae1a382ee56531da0e3 Mon Sep 17 00:00:00 2001 From: Chris Wilcox Date: Thu, 26 Dec 2019 10:59:08 -0800 Subject: [PATCH 3/3] fix: match recovered stream exceptions to node.js implementation, https://github.com/googleapis/nodejs-firestore/blob/25472e11a0e1a4a5e1931b1652d125f9c8cabf11/dev/src/watch.ts\#L817 --- firestore/google/cloud/firestore_v1/watch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/firestore/google/cloud/firestore_v1/watch.py b/firestore/google/cloud/firestore_v1/watch.py index 10c5953a17f0..2216acd4580a 100644 --- a/firestore/google/cloud/firestore_v1/watch.py +++ b/firestore/google/cloud/firestore_v1/watch.py @@ -58,7 +58,10 @@ } _RPC_ERROR_THREAD_NAME = "Thread-OnRpcTerminated" _RECOVERABLE_STREAM_EXCEPTIONS = ( + exceptions.Aborted, + exceptions.Cancelled, exceptions.Unknown, + exceptions.DeadlineExceeded, exceptions.ResourceExhausted, exceptions.InternalServerError, exceptions.ServiceUnavailable,