-
Notifications
You must be signed in to change notification settings - Fork 120
Node: add Batches support #3702
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
Conversation
avifenesh
left a comment
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.
First round, code itself
node/src/BaseClient.ts
Outdated
| raiseOnError, | ||
| options as ClusterBatchOptions, | ||
| ); | ||
| }).then((result: T) => { |
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.
Find a way to avoid an extra branch for each command, and limit it to one if
node/src/BaseClient.ts
Outdated
| ); | ||
| }).then((result: T) => { | ||
| if (Array.isArray(command) && Array.isArray(result)) { | ||
| for (const item of result) { |
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.
Using for of, create a generator before starting looping and then get the object filed every time from the object.
Instead, use a simple loop of for let i etc., and cache the length outside the loop to avoid getting into the length every time.
e.g.
const loopLen = result.length;
for(let i = 0; i < loopLen; i++)| // batch.configSet({[maxmemoryPolicyKey]: "allkeys-random"}); | ||
| expect(response[0]).toEqual("OK"); | ||
| // transaction.set(key, "foo"); | ||
| // batch.set(key, "foo"); |
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.
The comments are to know what is the content of the commands? We don't have a maintainable way to do it?
Who is going to know where to look for when there's a bug? Maybe a doc link to the test location?
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.
I just renamed transaction to batch
This is just an easy way to know the response for each command
|
|
||
| try { | ||
| const pipeline = new ClusterBatch(false); | ||
| pipeline.set("abc", "value"); |
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.
add comment of knowing its different slots and how
| async (protocol, isAtomic) => { | ||
| const client = await GlideClusterClient.createClient( | ||
| getClientConfigurationOption(cluster.getAddresses(), protocol, { | ||
| requestTimeout: 2000, |
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.
Do we recommend in the docs somewhere to use high timeout for batching? the docs of the config, not of the batch
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.
Not that I am aware of
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.
can we do? its seems that you run tests with pretty much sure knowledge
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.
Not really, I just copied the same structure above
|
|
||
| try { | ||
| expect(await client.configResetStat()).toEqual("OK"); | ||
| const key = uuidv4(); |
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.
no uuid anymore, rebase
avifenesh
left a comment
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.
good luck
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
--------- Signed-off-by: Shoham Elias <shohame@amazon.com>
Issue link
This Pull Request is linked to issue (URL): #3546
Checklist
Before submitting the PR make sure the following are checked: