Skip to content

Implement client Pause and Unpause command - #274

Merged
prateek-kumar-improving merged 10 commits into
mainfrom
implement-pause-unpause-command
Jul 28, 2026
Merged

Implement client Pause and Unpause command#274
prateek-kumar-improving merged 10 commits into
mainfrom
implement-pause-unpause-command

Conversation

@prateek-kumar-improving

@prateek-kumar-improving prateek-kumar-improving commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implement CLIENT PAUSE and CLIENT UNPAUSE commands for both standalone and cluster clients. CLIENT PAUSE suspends all client commands for a specified timeout, and CLIENT UNPAUSE resumes processing.

Issue link

This Pull Request is linked to issue: #236

Features / Behaviour Changes

  • Add ValkeyGlide::clientPause(int $timeout, ?string $mode = null): ValkeyGlide|bool|string
  • Add ValkeyGlide::clientUnpause(): ValkeyGlide|bool|string
  • Add ValkeyGlideCluster::clientPause(int $timeout, ?string $mode = null): ValkeyGlideCluster|bool|string
  • Add ValkeyGlideCluster::clientUnpause(): ValkeyGlideCluster|bool|string
  • With OPT_REPLY_LITERAL enabled, returns "OK" string
  • Supports pause modes: "ALL" (default, blocks all commands) and "WRITE" (blocks only writes)
  • In cluster mode, glide-core routes to all primary nodes by default (no explicit route param needed)

Implementation

  • execute_client_pause_command() in valkey_glide_commands.c — takes timeout (long) + optional mode (string)
  • execute_client_unpause_command() in valkey_glide_commands.c — zero-arg command
  • CLIENT_PAUSE_METHOD_IMPL and CLIENT_UNPAUSE_METHOD_IMPL macros in valkey_glide_commands_common.h
  • ClientPause uses prepare_message_args (handles long + optional string args)
  • ClientUnpause uses prepare_zero_args
  • Both use execute_and_handle_batch helper and status processors

Testing

Standalone tests (tests/ValkeyGlideTest.php) added.
Cluster tests (tests/ValkeyGlideClusterTest.php) added.
Build passes with -Werror, lint clean on all modified files.

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.

Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
@prateek-kumar-improving
prateek-kumar-improving marked this pull request as ready for review July 22, 2026 05:50
@prateek-kumar-improving prateek-kumar-improving changed the title Implement client Pause and Un pause command Implement client Pause and Unpause command Jul 22, 2026
@currantw
currantw self-requested a review July 22, 2026 16:31
Signed-off-by: prateek-kumar-improving <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Comment thread valkey_glide_cluster.stub.php

@jamesx-improving jamesx-improving left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice, clean reuse of the existing unified-command framework — the C-level implementation mirrors reset / bgSave and I have no correctness or security concerns there. Left a few unverified test-side questions inline that I couldn't confirm without an initialized glide-core submodule; happy to re-review once you've had a look.

Comment thread tests/ValkeyGlideClusterTest.php
Comment thread tests/ValkeyGlideTest.php
Comment thread tests/ValkeyGlideTest.php
@prateek-kumar-improving
prateek-kumar-improving removed the request for review from currantw July 27, 2026 23:23
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>

@jamesx-improving jamesx-improving left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks for the fixes.

@prateek-kumar-improving
prateek-kumar-improving merged commit afd2dbd into main Jul 28, 2026
40 of 44 checks passed
@prateek-kumar-improving
prateek-kumar-improving deleted the implement-pause-unpause-command branch July 28, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants