AydarZaynutdinov commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r784237568



##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,28 @@ func (controller *playgroundController) Cancel(ctx 
context.Context, info *pb.Can
 }
 
 // GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole 
catalog from the cache
+//     - If there is no catalog in the cache, gets the catalog from the 
Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog 
from the Storage
 func (controller *playgroundController) GetPrecompiledObjects(ctx 
context.Context, info *pb.GetPrecompiledObjectsRequest) 
(*pb.GetPrecompiledObjectsResponse, error) {
-       bucket := cloud_bucket.New()
-       sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk, 
info.Category)
+       if info.Sdk == pb.Sdk_SDK_UNSPECIFIED && info.Category == "" {
+               catalog, err := 
utils.GetPrecompiledObjectsCatalogFromCache(ctx, controller.cacheService)
+               if err == nil {
+                       return &pb.GetPrecompiledObjectsResponse{SdkCategories: 
catalog}, nil
+               } else {
+                       logger.Errorf("GetPrecompiledObjects(): cache error: 
%s", err.Error())
+               }

Review comment:
       ```suggestion
                }
                logger.Errorf("GetPrecompiledObjects(): cache error: %s", 
err.Error())
   ```




-- 
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