betim
Explore posts from serversDetecting batch queries/mutations on the server-side
Hello all,
Looking to leverage batching as a means to streamline some of our cross-service requests, both query and mutation. We have a graph of interconnected tRPC services, some of which form trees of calls where service A calls service B, and service B then calls service C. Looking to get some guidance on how to identify on the receiving side whether a particular method invocation is a part of a batch request so that I could then batch requests to a downstream service, eg. I receive 10 queries in a batch to service A, which I would then like to batch in a single call to service B, and so on.
Specifically:
1. Is there a mechanism I could introspect to tell that the current method invocation (query or mutation) is part of a batch request?
2. Is there a mechanism I could use to get access to the input and context of the other requests of the same type in the batch?
Thanks!
14 replies
CDCloudflare Developers
•Created by betim on 4/26/2023 in #workers-help
Workers on Custom Domains
Hello all, looking for clarification on the Workers on Custom Domains scenario documented in the second paragraph of https://developers.cloudflare.com/workers/platform/triggers/custom-domains/#fetch. From the phrasing, I'm taking it to mean that a subrequest fetch to https://api.example.com from worker A hosted on app.example.com (set up as a Cloudflare Custom domain) to worker B hosted on api.example.com (also set up as a Cloudflare Custom domain) should work. Is this correct?
From my tests, a fetch from worker A to api.example.com returns an HTTP 522 code. Other possibly pertinent details:
- I have other services running on example.com as well as it's other subdomains, all fronted by Cloudflare DNS.
- Parent domain name itself was purchased elsewhere but its DNS is hosted on Cloudflare.
1 replies