Merge pull request #6497 from oranagra/avoid_replica_traffic

Add config and module API for AvoidReplicaTraffic
This commit is contained in:
Salvatore Sanfilippo
2019-12-18 17:06:05 +01:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@ -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);