Skip to content

Commit ff6f3a5

Browse files
committed
refactor(maint): rename options
1 parent ed7b905 commit ff6f3a5

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

packages/client/lib/client/enterprise-maintenance-manager.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ export default class EnterpriseMaintenanceManager {
6464
#client: Client;
6565

6666
static setupDefaultMaintOptions(options: RedisClientOptions) {
67-
if (options.maintPushNotifications === undefined) {
68-
options.maintPushNotifications =
67+
if (options.maintNotifications === undefined) {
68+
options.maintNotifications =
6969
options?.RESP === 3 ? "auto" : "disabled";
7070
}
71-
if (options.maintMovingEndpointType === undefined) {
72-
options.maintMovingEndpointType = "auto";
71+
if (options.maintEndpointType === undefined) {
72+
options.maintEndpointType = "auto";
7373
}
7474
if (options.maintRelaxedSocketTimeout === undefined) {
7575
options.maintRelaxedSocketTimeout = 10000;
@@ -87,7 +87,7 @@ export default class EnterpriseMaintenanceManager {
8787
| { cmd: Array<RedisArgument>; errorHandler: (error: Error) => void }
8888
| undefined
8989
> {
90-
if (options.maintPushNotifications === "disabled") return;
90+
if (options.maintNotifications === "disabled") return;
9191

9292
const movingEndpointType = await determineEndpoint(tls, host, options);
9393
return {
@@ -100,7 +100,7 @@ export default class EnterpriseMaintenanceManager {
100100
],
101101
errorHandler: (error: Error) => {
102102
dbgMaintenance("handshake failed:", error);
103-
if (options.maintPushNotifications === "enabled") {
103+
if (options.maintNotifications === "enabled") {
104104
throw error;
105105
}
106106
},
@@ -189,7 +189,7 @@ export default class EnterpriseMaintenanceManager {
189189
// reconnect to its currently configured endpoint after half of the grace
190190
// period that was communicated by the server is over.
191191
if (url === null) {
192-
assert(this.#options.maintMovingEndpointType === "none");
192+
assert(this.#options.maintEndpointType === "none");
193193
assert(this.#options.socket !== undefined);
194194
assert("host" in this.#options.socket);
195195
assert(typeof this.#options.socket.host === "string");
@@ -329,12 +329,12 @@ async function determineEndpoint(
329329
host: string,
330330
options: RedisClientOptions,
331331
): Promise<MovingEndpointType> {
332-
assert(options.maintMovingEndpointType !== undefined);
333-
if (options.maintMovingEndpointType !== "auto") {
332+
assert(options.maintEndpointType !== undefined);
333+
if (options.maintEndpointType !== "auto") {
334334
dbgMaintenance(
335-
`Determine endpoint type: ${options.maintMovingEndpointType}`,
335+
`Determine endpoint type: ${options.maintEndpointType}`,
336336
);
337-
return options.maintMovingEndpointType;
337+
return options.maintEndpointType;
338338
}
339339

340340
const ip = isIP(host) ? host : (await lookup(host, { family: 0 })).address;

packages/client/lib/client/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export interface RedisClientOptions<
154154
*
155155
* The default is `auto`.
156156
*/
157-
maintPushNotifications?: 'disabled' | 'enabled' | 'auto';
157+
maintNotifications?: 'disabled' | 'enabled' | 'auto';
158158
/**
159159
* Controls how the client requests the endpoint to reconnect to during a MOVING notification in Redis Enterprise maintenance.
160160
*
@@ -167,19 +167,19 @@ export interface RedisClientOptions<
167167
168168
* The default is `auto`.
169169
*/
170-
maintMovingEndpointType?: MovingEndpointType;
170+
maintEndpointType?: MovingEndpointType;
171171
/**
172172
* Specifies a more relaxed timeout (in milliseconds) for commands during a maintenance window.
173-
* This helps minimize command timeouts during maintenance. If not provided, the `commandOptions.timeout`
174-
* will be used instead. Timeouts during maintenance period result in a `CommandTimeoutDuringMaintenance` error.
173+
* This helps minimize command timeouts during maintenance. Timeouts during maintenance period result
174+
* in a `CommandTimeoutDuringMaintenance` error.
175175
*
176176
* The default is 10000
177177
*/
178178
maintRelaxedCommandTimeout?: number;
179179
/**
180180
* Specifies a more relaxed timeout (in milliseconds) for the socket during a maintenance window.
181-
* This helps minimize socket timeouts during maintenance. If not provided, the `socket.timeout`
182-
* will be used instead. Timeouts during maintenance period result in a `SocketTimeoutDuringMaintenance` error.
181+
* This helps minimize socket timeouts during maintenance. Timeouts during maintenance period result
182+
* in a `SocketTimeoutDuringMaintenance` error.
183183
*
184184
* The default is 10000
185185
*/
@@ -503,7 +503,7 @@ export default class RedisClient<
503503
this.#socket = this.#initiateSocket();
504504

505505

506-
if(options?.maintPushNotifications !== 'disabled') {
506+
if(options?.maintNotifications !== 'disabled') {
507507
new EnterpriseMaintenanceManager(this.#queue, this, this.#options!);
508508
};
509509

@@ -535,7 +535,7 @@ export default class RedisClient<
535535
throw new Error('Client Side Caching is only supported with RESP3');
536536
}
537537

538-
if (options?.maintPushNotifications && options?.maintPushNotifications !== 'disabled' && options?.RESP !== 3) {
538+
if (options?.maintNotifications && options?.maintNotifications !== 'disabled' && options?.RESP !== 3) {
539539
throw new Error('Graceful Maintenance is only supported with RESP3');
540540
}
541541

@@ -563,7 +563,7 @@ export default class RedisClient<
563563
this._commandOptions = options.commandOptions;
564564
}
565565

566-
if(options?.maintPushNotifications !== 'disabled') {
566+
if(options?.maintNotifications !== 'disabled') {
567567
EnterpriseMaintenanceManager.setupDefaultMaintOptions(options!);
568568
}
569569

0 commit comments

Comments
 (0)