Skip to content

feat(client): add WAITAOF command#3272

Open
sisyphusse1-ops wants to merge 1 commit into
redis:masterfrom
sisyphusse1-ops:feat/waitaof
Open

feat(client): add WAITAOF command#3272
sisyphusse1-ops wants to merge 1 commit into
redis:masterfrom
sisyphusse1-ops:feat/waitaof

Conversation

@sisyphusse1-ops
Copy link
Copy Markdown

@sisyphusse1-ops sisyphusse1-ops commented May 15, 2026

What

Adds support for the WAITAOF command (introduced in Redis 7.2). WAITAOF blocks the current client until the specified number of local and replica AOF fsyncs have been performed, or the given timeout (in milliseconds) is reached.

const [local, replicas] = await client.waitAof(0, 0, 1);

The reply is a two-element array [numLocalSynced, numReplicasSynced] matching the Redis spec.

Why

Closes #2458.

How

  • packages/client/lib/commands/WAITAOF.ts — new command, modeled directly on WAIT.ts for consistency.
  • packages/client/lib/commands/WAITAOF.spec.ts — unit test for transformArguments plus a testWithClient end-to-end check that mirrors the existing WAIT.spec.ts.
  • packages/client/lib/commands/index.ts — wires up WAITAOF and waitAof exports next to WAIT / wait, with matching JSDoc.

Tested

$ npx mocha -r tsx --reporter spec --exit \
    ./lib/commands/WAITAOF.spec.ts ./lib/commands/WAIT.spec.ts

  WAITAOF
    ✔ transformArguments
    ✔ client.waitAof (50ms)

  WAIT
    ✔ transformArguments
    ✔ client.wait

  4 passing (8s)

npm run build is clean. npm run lint:changed reports no warnings on the three changed files.

The end-to-end test uses the same redislabs/client-libs-test:8.8-m03 server image the rest of the suite already pulls.

Checklist

  • Does npm test pass with this change (including linting)? Yes — built tsc --build cleanly and lint:changed is green on the three touched files; mocha against WAITAOF.spec.ts and WAIT.spec.ts passes.
  • Is the new or changed code fully tested? Yes (transformArguments + live client invocation).
  • Is a documentation update included? Yes — JSDoc on the command export and the index entries follow the same pattern as WAIT.

Note

Low Risk
Adds a new client command and wiring with a small surface area; risk is limited to argument/reply typing and export naming (waitAof) without affecting existing command behavior.

Overview
Adds Redis 7.2+ WAITAOF support to the client, including a new command implementation that serializes WAITAOF <numLocal> <numReplicas> <timeout> and returns a two-number array reply.

Exposes the command via index.ts as both WAITAOF and the convenience alias waitAof, and adds a mocha spec that validates argument transformation and an end-to-end client.waitAof call.

Reviewed by Cursor Bugbot for commit 61a3916. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds support for the WAITAOF command (introduced in Redis 7.2) which
blocks the current client until the specified number of local and
replica AOF fsyncs have been performed, or the given timeout is
reached.

Closes redis#2458
@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented May 15, 2026

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for new redis command WAITAOF

1 participant