resgateio / resgate

A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.
https://resgate.io
MIT License
685 stars 67 forks source link

Reference throttling #209

Closed jirenius closed 2 years ago

jirenius commented 2 years ago

Issue

When Resgate subscribes to a resource (due to client subscribe requests, add events on a collection, change events on a model, etc.), it will recursively follow any resource reference for that resource.

If a lot of resources are referenced, the service(s) may be overwhelmed by requests, failing to respond within Resgate's default timeout period of 3 seconds. This will in turn result in Resgate setting the references to a system.timeout error for any timed out resource.

Solution

It should be possible to throttle the number of concurrent requests being sent when following resource references. This can be done by introducing a single integer configuration value:

jirenius commented 2 years ago

Resolved in RP #210