diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2019-12-18 17:06:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-18 17:06:05 +0100 |
commit | ef0b45ece8ee629dc2234f9061e0b28f9159df55 (patch) | |
tree | 917d076c5cf85bb96f6007951a5454834d326e79 /src/module.c | |
parent | 5a72c5058c27cdc778cde8f61d16691b11a6adc5 (diff) | |
parent | b5f3247ca55424d57d77efe51bedd1fb3861c8c0 (diff) | |
download | redis-ef0b45ece8ee629dc2234f9061e0b28f9159df55.tar.gz |
Merge pull request #6497 from oranagra/avoid_replica_traffic
Add config and module API for AvoidReplicaTraffic
Diffstat (limited to 'src/module.c')
-rw-r--r-- | src/module.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c index 1fda29625..f6f4ef2b9 100644 --- a/src/module.c +++ b/src/module.c @@ -1900,6 +1900,14 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) { return flags; } +/* Returns true when the module should avoid actions that cause traffic to replicas. + * This is required during manual failover when waiting for the replica + * to be in perfect sync with the master. Modules doing background operations + * which are not a result of user traffic should check this flag periodically. */ +int RM_AvoidReplicaTraffic() { + return clientsArePaused(); +} + /* Change the currently selected DB. Returns an error if the id * is out of range. * @@ -7649,6 +7657,7 @@ void moduleRegisterCoreAPI(void) { REGISTER_API(KeyAtPos); REGISTER_API(GetClientId); REGISTER_API(GetContextFlags); + REGISTER_API(AvoidReplicaTraffic); REGISTER_API(PoolAlloc); REGISTER_API(CreateDataType); REGISTER_API(ModuleTypeSetValue); |