Nov 30, 2021 — Retry capability included in the helper library

The EdgeKV JavaScript helper library (version 0.5.0) now includes a retry capability. The num_retries_on_timeout parameter lets you specify the maximum number of retries to attempt when executing the getText() and getJson() methods. You can also specify the number of retries to attempt in the Constructor.

On cold hits, where a value is not present in the edge cache, EdgeKV GET requests may exceed the EdgeWorkers sub-request timeout limits. EdgeWorkers event execution can fail if the timeout is not explicitly handled in the JavaScript code. This can also be problematic in a production environment where the EdgeWorkers function executes in geographies outside the configured namespace geolocation.

To help prevent a GET request from failing you can include the retry capability. A retry is more likely to succeed instead of timing out because there is a chance that the data has already reached the local server. This increases the success rate of EdgeWorkers event executions for EdgeKV cold hit access but comes at the expense of additional latency when retries are executed.

Please note that each retry request is a separate, billable READ request. You can specify the num_retries_on_timeout parameter as a value in the EdgeKV Constructor, or each time getText() or getJson() is invoked. For more information about the num_retries_on_timeout parameter refer to Library helper methods in the EdgeKV documentation.