summaryrefslogtreecommitdiff
path: root/src/module.c
diff options
context:
space:
mode:
authorMadelyn Olson <34459052+madolson@users.noreply.github.com>2021-01-07 23:36:54 -0800
committerGitHub <noreply@github.com>2021-01-07 23:36:54 -0800
commit47579bdf5cccfbac1cf2b6e7e52218c5b9faed86 (patch)
treed446b07c138dd8151277dba04ea9a75d2e810a92 /src/module.c
parentb02780c41dbc5b28d265b5cf141c03c1a7383ef9 (diff)
downloadredis-47579bdf5cccfbac1cf2b6e7e52218c5b9faed86.tar.gz
Add support for client pause WRITE (#8170)
Implementation of client pause WRITE and client unpause
Diffstat (limited to 'src/module.c')
-rw-r--r--src/module.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c
index c9e0b8812..bf186f8b7 100644
--- a/src/module.c
+++ b/src/module.c
@@ -747,6 +747,7 @@ int64_t commandFlagsFromString(char *s) {
else if (!strcasecmp(t,"no-slowlog")) flags |= CMD_SKIP_SLOWLOG;
else if (!strcasecmp(t,"fast")) flags |= CMD_FAST;
else if (!strcasecmp(t,"no-auth")) flags |= CMD_NO_AUTH;
+ else if (!strcasecmp(t,"may-replicate")) flags |= CMD_MAY_REPLICATE;
else if (!strcasecmp(t,"getkeys-api")) flags |= CMD_MODULE_GETKEYS;
else if (!strcasecmp(t,"no-cluster")) flags |= CMD_MODULE_NO_CLUSTER;
else break;
@@ -813,6 +814,8 @@ int64_t commandFlagsFromString(char *s) {
* * **"no-auth"**: This command can be run by an un-authenticated client.
* Normally this is used by a command that is used
* to authenticate a client.
+ * * **"may-replicate"**: This command may generate replication traffic, even
+ * though it's not a write command.
*/
int RM_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep) {
int64_t flags = strflags ? commandFlagsFromString((char*)strflags) : 0;
@@ -2042,7 +2045,7 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
* periodically in timer callbacks or other periodic callbacks.
*/
int RM_AvoidReplicaTraffic() {
- return clientsArePaused();
+ return checkClientPauseTimeoutAndReturnIfPaused();
}
/* Change the currently selected DB. Returns an error if the id