Skip to content

Conversation

@shohamazon
Copy link
Collaborator

Issue link

This Pull Request is linked to issue (URL): #3546

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Create merge commit if merging release branch into main, squash otherwise.

@shohamazon shohamazon requested a review from a team as a code owner April 29, 2025 10:29
@shohamazon shohamazon self-assigned this Apr 29, 2025
@shohamazon shohamazon added node 🐢 Node.js wrapper 2_0_candidate Candidate task for version 2.0 labels Apr 29, 2025
This was referenced Apr 29, 2025
Copy link
Member

@avifenesh avifenesh left a 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

raiseOnError,
options as ClusterBatchOptions,
);
}).then((result: T) => {
Copy link
Member

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

);
}).then((result: T) => {
if (Array.isArray(command) && Array.isArray(result)) {
for (const item of result) {
Copy link
Member

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");
Copy link
Member

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?

Copy link
Collaborator Author

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");
Copy link
Member

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,
Copy link
Member

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

Copy link
Collaborator Author

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

Copy link
Member

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

Copy link
Collaborator Author

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no uuid anymore, rebase

Copy link
Member

@avifenesh avifenesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good luck

shohamazon added 4 commits May 7, 2025 11:59
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>
shohamazon added 11 commits May 7, 2025 11:59
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>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
Signed-off-by: Shoham Elias <shohame@amazon.com>
@shohamazon shohamazon merged commit c2dad6f into main May 7, 2025
21 checks passed
@shohamazon shohamazon deleted the node/batch branch May 7, 2025 12:34
ikolomi pushed a commit that referenced this pull request May 11, 2025
---------

Signed-off-by: Shoham Elias <shohame@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2_0_candidate Candidate task for version 2.0 node 🐢 Node.js wrapper

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants