Replies: 1 comment 7 replies
-
I suggest the following changes:
api_keys = Async do
response = flow_client.api_keys(project_id: params[:flow_id])
response.read
ensure
response&.close
end
destinations = Async do
response = flow_client.destinations(project_id: params[:flow_id])
response.read
ensure
response&.close
end
sources = Async do
response = flow_client.sources(project_id: params[:flow_id])
response.read
ensure
response&.close
end
# Now, we wait for each asynchronous call to complete
@api_keys = api_keys.wait
@destinations = destinations.wait
@sources = sources.wait This code executes three asynchronous API requests concurrently to fetch API keys, destinations, and sources for a given project ID ( Let me know if you need further clarification or help :) |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, I wanted to know if this code is correct?
Beta Was this translation helpful? Give feedback.
All reactions