mirror of https://github.com/redis/redis.git
				
				
				
			Simplify comment in moduleTryServeClientBlockedOnKey().
This commit is contained in:
		
							parent
							
								
									545a5046f5
								
							
						
					
					
						commit
						80ec0431e8
					
				
							
								
								
									
										15
									
								
								src/module.c
								
								
								
								
							
							
						
						
									
										15
									
								
								src/module.c
								
								
								
								
							| 
						 | 
					@ -4398,21 +4398,12 @@ RedisModuleBlockedClient *moduleBlockClient(RedisModuleCtx *ctx, RedisModuleCmdF
 | 
				
			||||||
int moduleTryServeClientBlockedOnKey(client *c, robj *key) {
 | 
					int moduleTryServeClientBlockedOnKey(client *c, robj *key) {
 | 
				
			||||||
    int served = 0;
 | 
					    int served = 0;
 | 
				
			||||||
    RedisModuleBlockedClient *bc = c->bpop.module_blocked_handle;
 | 
					    RedisModuleBlockedClient *bc = c->bpop.module_blocked_handle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Protect against re-processing: don't serve clients that are already
 | 
					    /* Protect against re-processing: don't serve clients that are already
 | 
				
			||||||
     * in the unblocking list for any reason (including RM_UnblockClient()
 | 
					     * in the unblocking list for any reason (including RM_UnblockClient()
 | 
				
			||||||
     * explicit call).
 | 
					     * explicit call). See #6798. */
 | 
				
			||||||
     * For example, the following pathological case:
 | 
					 | 
				
			||||||
     * Assume a module called LIST implements the same command as
 | 
					 | 
				
			||||||
     * the Redis list data type.
 | 
					 | 
				
			||||||
     * LIST.BRPOPLPUSH src dst 0 ('src' goes into db->blocking_keys)
 | 
					 | 
				
			||||||
     * LIST.BRPOPLPUSH dst src 0 ('dst' goes into db->blocking_keys)
 | 
					 | 
				
			||||||
     * LIST.LPUSH src foo
 | 
					 | 
				
			||||||
     * 'src' is in db->blocking_keys after the first BRPOPLPUSH is served
 | 
					 | 
				
			||||||
     * (and stays there until the next beforeSleep).
 | 
					 | 
				
			||||||
     * The second BRPOPLPUSH will signal 'src' as ready, leading to the
 | 
					 | 
				
			||||||
     * unblocking of the already unblocked (and worst, freed) reply_client
 | 
					 | 
				
			||||||
     * of the first BRPOPLPUSH. */
 | 
					 | 
				
			||||||
    if (bc->unblocked) return 0;
 | 
					    if (bc->unblocked) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    RedisModuleCtx ctx = REDISMODULE_CTX_INIT;
 | 
					    RedisModuleCtx ctx = REDISMODULE_CTX_INIT;
 | 
				
			||||||
    ctx.flags |= REDISMODULE_CTX_BLOCKED_REPLY;
 | 
					    ctx.flags |= REDISMODULE_CTX_BLOCKED_REPLY;
 | 
				
			||||||
    ctx.blocked_ready_key = key;
 | 
					    ctx.blocked_ready_key = key;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue