Timeouts and Reconnect Strategy
Valkey GLIDE allows you to configure timeout settings and reconnect strategies. These configurations can be applied through the GlideClusterClientConfiguration and GlideClientConfiguration parameters.
| Configuration setting | Description | Default value |
|---|---|---|
| requestTimeout | This specified time duration, measured in milliseconds, represents the period during which the client will await the completion of a request. This time frame includes the process of sending the request, waiting for a response from the node(s), and any necessary reconnection or retry attempts. If a pending request exceeds the specified timeout, it will trigger a timeout error. If no timeout value is explicitly set, a default value will be employed. | 250 milliseconds |
| connectionBackoff | The reconnection strategy defines how and when reconnection attempts are made in the event of connection failures | Exponential backoff |
Example: Setting Increased Request Timeout for Long-Running Commands
Section titled “Example: Setting Increased Request Timeout for Long-Running Commands”import {GlideClusterClient} from "@valkey/valkey-glide";
const addresses = [ { host: "address.example.com", port: 6379 }];
const client = await GlideClusterClient.createClient({ addresses: addresses, requestTimeout: 500});