-
Notifications
You must be signed in to change notification settings - Fork 2
Sentinel #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v5
Are you sure you want to change the base?
Sentinel #10
Conversation
note, tsconfig.base.json as is, doesn't transpile import into request, which gives m problems when testing by hand. |
return { "host": data[3], "port": Number(data[5]) }; | ||
} | ||
|
||
export function createNodeList(data: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of any for typing here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I dont know how to get typing out of raw redis commands yet.
|
||
for (const nodeData of data) { | ||
const node = parseNode(nodeData) | ||
if (node === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined is like false in node - can we do an if/else here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean? in this case, I have parseNode return undefined for a node that is down, so can ignore it.
); | ||
|
||
export default class RedisSentinelMultiCommand<REPLIES = []> { | ||
private static _createCommand(command: Command, resp: RespVersions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of boilerplating - can this be done better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied/pasted from cluster object
+ don't need both sentinel client and pubsubclient + nits
returned by aquire() used by function passed to use()
1) it takes a lot of time now, so needs larger timeout 2) docker logs can be large, so need to increase maxBuffer size so doesn't error (and break test clean up)
+ provide API for other wrapper clients to also create invalid watch states programatically. Reasoning: if a user does a WATCH and then the client reconnects, the watch is no longer active, but if a user does a MULTI/EXEC after that, they wont know, and since the WATCH is no longer active, the request has no protection. The API is needed for when a wrapper client (say sentinel, cluster) might close the underlying client and reopen a new one transparently to the user. Just like in the reconnection case, this should result in an error, but its up to the wrapping client to provide the appropriate error
…type, some more cleanups
self -> _self change
though I realize this implementation, really only works after the first write command. unsure this is worth it.
no more semaphore type counting
Description
Checklist
npm test
pass with this change (including linting)?