Skip to content

Commit 7d4f461

Browse files
msotheeswaran-scGitHub Enterprise
authored andcommitted
Make propagating before freeing module context optional (#225)
* don't propogate on module context free for rdb load * default in wrong place
1 parent 820482b commit 7d4f461

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/module.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,9 @@ void moduleHandlePropagationAfterCommandCallback(RedisModuleCtx *ctx) {
690690
}
691691

692692
/* Free the context after the user function was called. */
693-
void moduleFreeContext(RedisModuleCtx *ctx) {
694-
moduleHandlePropagationAfterCommandCallback(ctx);
693+
void moduleFreeContext(RedisModuleCtx *ctx, bool propogate) {
694+
if (propogate)
695+
moduleHandlePropagationAfterCommandCallback(ctx);
695696
autoMemoryCollect(ctx);
696697
poolAllocRelease(ctx);
697698
if (ctx->postponed_arrays) {

src/rdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2542,7 +2542,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error, uint64_t mvcc_ts
25422542
* encoding version in the lower 10 bits of the module ID. */
25432543
void *ptr = mt->rdb_load(&io,moduleid&1023);
25442544
if (io.ctx) {
2545-
moduleFreeContext(io.ctx);
2545+
moduleFreeContext(io.ctx, false /* propogate */);
25462546
zfree(io.ctx);
25472547
}
25482548

src/server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2918,7 +2918,7 @@ int moduleGetCommandKeysViaAPI(struct redisCommand *cmd, robj **argv, int argc,
29182918
moduleType *moduleTypeLookupModuleByID(uint64_t id);
29192919
void moduleTypeNameByID(char *name, uint64_t moduleid);
29202920
const char *moduleTypeModuleName(moduleType *mt);
2921-
void moduleFreeContext(struct RedisModuleCtx *ctx);
2921+
void moduleFreeContext(struct RedisModuleCtx *ctx, bool propogate = true);
29222922
void unblockClientFromModule(client *c);
29232923
void moduleHandleBlockedClients(int iel);
29242924
void moduleBlockedClientTimedOut(client *c);

0 commit comments

Comments
 (0)