grid-checkout-library
This library was generated with Nx.
Running unit tests
Run nx test grid-checkout-library
to execute the unit tests via Jest.
Pre-publish build:
nx run grid-checkout-library:build
Publish:
nx run grid-checkout-library:publish
Request timeout implementation:
When dealing with API request timeouts, you may want to take into account various factors and conditions, as network conditions can be quite volatile. Because of this we can not use static timeout value for all requests. We need to set timeout value based on the network conditions.
The naive approach could be to set timeout value based on an average request delay.
Rather than setting the timeout based on the average request time, you can use the 95th or 99th percentile latency. This helps to ensure the timeout value isn't skewed by a few very fast or very slow requests. This is called Tail Latency measurement.
To implement Tail Latency measurement, we would want to keep track of the last N request times in an array, sort the array, and set the timeout to the 95th or 99th percentile of these values. This approach assumes that a small percentage of requests might be unusually slow, and we don't want these outliers to excessively influence our timeout value.
Want to learn more?
Ask chat gpt "How to implement request timeout using Tail Latency measurement?"