KonradJanica commented on a change in pull request #16244:
URL: https://github.com/apache/beam/pull/16244#discussion_r772642955



##########
File path: 
playground/frontend/lib/modules/editor/repository/code_repository/code_client/grpc_code_client.dart
##########
@@ -83,13 +83,14 @@ class GrpcCodeClient implements CodeClient {
   ) {
     return _runSafely(() => createClient(request.sdk)
         .getRunOutput(grpc.GetRunOutputRequest(pipelineUuid: pipelineUuid))
-        .then((response) => _toOutputResponse(response.output)));
+        .then((response) => _toOutputResponse(response.output))
+        .catchError((err) => _toOutputResponse('')));

Review comment:
       There should be a logger in the `catchError` so that we can find 
potential problems.

##########
File path: playground/frontend/lib/utils/run_with_retry.dart
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const kDefaultRetryCount = 5;
+const kDefaultRetryWaitMs = 2000;
+
+Future<T> runWithRetry<T>(Future<T> Function() fn,

Review comment:
       Nit: Explain this API by adding a [doc 
comment](https://dart.dev/guides/language/effective-dart/documentation#prefer-writing-doc-comments-for-public-apis).
 

##########
File path: playground/frontend/lib/utils/run_with_retry.dart
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const kDefaultRetryCount = 5;
+const kDefaultRetryWaitMs = 2000;
+
+Future<T> runWithRetry<T>(Future<T> Function() fn,
+    {int retryCount = kDefaultRetryCount,
+    int retryWaitMs = kDefaultRetryWaitMs,
+    int attemptNumber = 1}) async {

Review comment:
       `attemptNumber` should not be exposed to the caller. Perhaps move the 
recursion to a nested helper function or create a class with private functions.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to