Skip to content

Commit 10ff6de

Browse files
authored
fix(sentinel): Migrated to the new testing framework, fixed issues that were discovered during transition
* [CAE-342] Fix a couple of bugs * Fixed issue with nodes masterauth persistency, changed docker container * [CAE-342] Fixed a couple of sentinel issues, enabled most tests * [CAE-342] Added comment * [CAE-342] Migrate majority of tests to testUtils * [CAE-342] Minor refactor * . * [CAE-342] Using cae containers for sentinel * [CAE-342] Improved resiliency of the legacy tests, added TSdoc comment * [CAE-342] Some extra logging, removed unneeded changes * [CAE-342] Moved docker env as optional part of redisserverdockerconfig * [CAE-342] Move password to serverArguments * [CAE-342] Moved ts-node to devDependencies * [CAE-342] Reverted legacy testing framework improvements
1 parent 048df30 commit 10ff6de

File tree

9 files changed

+1421
-1215
lines changed

9 files changed

+1421
-1215
lines changed

package-lock.json

+176-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"release-it": "^17.0.3",
2222
"tsx": "^4.7.0",
2323
"typedoc": "^0.25.7",
24-
"typescript": "^5.3.3"
24+
"typescript": "^5.3.3",
25+
"ts-node": "^10.9.2"
2526
}
2627
}

packages/client/lib/client/index.ts

+17
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ export default class RedisClient<
299299
#monitorCallback?: MonitorCallback<TYPE_MAPPING>;
300300
private _self = this;
301301
private _commandOptions?: CommandOptions<TYPE_MAPPING>;
302+
// flag used to annotate that the client
303+
// was in a watch transaction when
304+
// a topology change occured
302305
#dirtyWatch?: string;
303306
#epoch: number;
304307
#watchEpoch?: number;
@@ -325,6 +328,20 @@ export default class RedisClient<
325328
return this._self.#watchEpoch !== undefined;
326329
}
327330

331+
/**
332+
* Indicates whether the client's WATCH command has been invalidated by a topology change.
333+
* When this returns true, any transaction using WATCH will fail with a WatchError.
334+
* @returns true if the watched keys have been modified, false otherwise
335+
*/
336+
get isDirtyWatch(): boolean {
337+
return this._self.#dirtyWatch !== undefined
338+
}
339+
340+
/**
341+
* Marks the client's WATCH command as invalidated due to a topology change.
342+
* This will cause any subsequent EXEC in a transaction to fail with a WatchError.
343+
* @param msg - The error message explaining why the WATCH is dirty
344+
*/
328345
setDirtyWatch(msg: string) {
329346
this._self.#dirtyWatch = msg;
330347
}

0 commit comments

Comments
 (0)