Commit 211e985e authored by antirez's avatar antirez
Browse files

alsoPropagate(): just propagate() when out of context.

parent 7cb97aa6
...@@ -3110,7 +3110,10 @@ void propagate(struct redisCommand *cmd, int dbid, robj **argv, int argc, ...@@ -3110,7 +3110,10 @@ void propagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
* The function does not take a reference to the passed 'argv' vector, * The function does not take a reference to the passed 'argv' vector,
* so it is up to the caller to release the passed argv (but it is usually * so it is up to the caller to release the passed argv (but it is usually
* stack allocated). The function autoamtically increments ref count of * stack allocated). The function autoamtically increments ref count of
* passed objects, so the caller does not need to. */ * passed objects, so the caller does not need to.
*
* Note that if we are outside the execution of a command, that is we
* are not inside call(), this function will just act like propagate(). */
void alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc, void alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
int target) int target)
{ {
...@@ -3119,6 +3122,13 @@ void alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc, ...@@ -3119,6 +3122,13 @@ void alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
if (server.loading) return; /* No propagation during loading. */ if (server.loading) return; /* No propagation during loading. */
/* Just call propagate() if we are out of the scope of a command.
* For asynchronous operations usually we want to propagate immediately. */
if (server.current_client == NULL) {
propagate(cmd,dbid,argv,argc,target);
return;
}
argvcopy = zmalloc(sizeof(robj*)*argc); argvcopy = zmalloc(sizeof(robj*)*argc);
for (j = 0; j < argc; j++) { for (j = 0; j < argc; j++) {
argvcopy[j] = argv[j]; argvcopy[j] = argv[j];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment