Skip to content

Commit a02f19e

Browse files
authored
Remove master field from DAG run_info, only check the ref_counter in the free function. (#519)
1 parent 620dc25 commit a02f19e

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/run_info.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ int RAI_InitRunInfo(RedisAI_RunInfo **result) {
129129
rinfo->dagDeviceOpCount = 0;
130130
rinfo->dagDeviceCompleteOpCount = 0;
131131
pthread_rwlock_init(rinfo->dagLock, NULL);
132-
rinfo->master = 1;
133132
rinfo->timedOut = RedisModule_Calloc(1, sizeof(int));
134133
*result = rinfo;
135134
return REDISMODULE_OK;
@@ -148,7 +147,6 @@ int RAI_ShallowCopyDagRunInfo(RedisAI_RunInfo **result, RedisAI_RunInfo *src) {
148147
}
149148
rinfo->dagDeviceOpCount = 0;
150149
rinfo->dagDeviceCompleteOpCount = 0;
151-
rinfo->master = 0;
152150
*result = rinfo;
153151
return REDISMODULE_OK;
154152
}
@@ -203,7 +201,7 @@ void RAI_FreeRunInfo(RedisModuleCtx *ctx, struct RedisAI_RunInfo *rinfo) {
203201
if (!rinfo) {
204202
return;
205203
}
206-
if (rinfo->master == 0) {
204+
if (*rinfo->dagRefCount > 0) {
207205
if (rinfo->dagDeviceOps) {
208206
array_free(rinfo->dagDeviceOps);
209207
}

src/run_info.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ typedef struct RedisAI_RunInfo {
8888
pthread_rwlock_t *dagLock;
8989
// Pointer to ref count in DAG, shared across multiple worker thread
9090
long long *dagRefCount;
91-
int master;
9291
long long timeout;
9392
int *timedOut;
9493
struct timeval queuingTime;

0 commit comments

Comments
 (0)