diff --git a/csst_dfs_api_cluster/common/catalog.py b/csst_dfs_api_cluster/common/catalog.py index d6b5f60df7a6c2f49b9bcdf1704eb20b3e702530..33d404d0e16d60c01c32ce0927adc3ef8434eb23 100644 --- a/csst_dfs_api_cluster/common/catalog.py +++ b/csst_dfs_api_cluster/common/catalog.py @@ -27,8 +27,7 @@ class CatalogApi(object): return: csst_dfs_common.models.Result ''' try: - t_start = time.time() - resp, _ = self.stub.Gaia3Search.with_call(ephem_pb2.EphemSearchRequest( + resps, _ = self.stub.Gaia3Search.with_call(ephem_pb2.EphemSearchRequest( ra = ra, dec = dec, radius = radius, @@ -37,17 +36,16 @@ class CatalogApi(object): obstime = obstime, limit = limit ),metadata = get_auth_headers()) - t_end = time.time() - log.info("gaia3_query used: %.6f's" %(t_end - t_start,)) - if resp.success: - t_start = time.time() - data = from_proto_model_list(Gaia3Record, resp.records) - t_end = time.time() - # log.info("object deserialization used: %.6f's" %(t_end - t_start,)) - return Result.ok_data(data = data).append("totalCount", resp.totalCount) - else: - return Result.error(message = str(resp.error.detail)) - + records = [] + totalCount = 0 + for resp in resps: + if resp.success: + data = from_proto_model_list(Gaia3Record, resp.records) + records.extend(data) + totalCount = resp.totalCount + else: + return Result.error(message = str(resp.error.detail)) + return Result.ok_data(data = records).append("totalCount", totalCount) except grpc.RpcError as e: return Result.error(message="%s:%s" % (e.code().value, e.details()))