Skip to content

Commit f1e7e22

Browse files
committed
Fix bug in create command for scriptget, minor fix when trying to get a non existing model.
1 parent 79e1f32 commit f1e7e22

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/redis_ai_objects/model.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ int RAI_GetModelFromKeyspace(RedisModuleCtx *ctx, RedisModuleString *keyName, RA
223223
RedisModule_Log(ctx, "warning", "could not load %s from keyspace, key doesn't exist",
224224
RedisModule_StringPtrLen(keyName, NULL));
225225
RAI_SetError(err, RAI_EKEYEMPTY, "ERR model key is empty");
226-
return REDISMODULE_ERR;
227226
#else
228227
if (VerifyKeyInThisShard(ctx, keyName)) { // Relevant for enterprise cluster.
229228
RAI_SetError(err, RAI_EKEYEMPTY, "ERR model key is empty");
@@ -232,6 +231,7 @@ int RAI_GetModelFromKeyspace(RedisModuleCtx *ctx, RedisModuleString *keyName, RA
232231
"ERR CROSSSLOT Keys in request don't hash to the same slot");
233232
}
234233
#endif
234+
return REDISMODULE_ERR;
235235
}
236236
if (RedisModule_ModuleTypeGetType(key) != RedisAI_ModelType) {
237237
RedisModule_CloseKey(key);

src/redis_ai_objects/script.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ int RAI_GetScriptFromKeyspace(RedisModuleCtx *ctx, RedisModuleString *keyName, R
7474
RedisModule_Log(ctx, "warning", "could not load %s from keyspace, key doesn't exist",
7575
RedisModule_StringPtrLen(keyName, NULL));
7676
RAI_SetError(err, RAI_EKEYEMPTY, "ERR script key is empty");
77-
return REDISMODULE_ERR;
7877
#else
7978
if (VerifyKeyInThisShard(ctx, keyName)) { // Relevant for enterprise cluster.
8079
RAI_SetError(err, RAI_EKEYEMPTY, "ERR script key is empty");

src/redisai.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
13871387
return REDISMODULE_ERR;
13881388

13891389
if (RedisModule_CreateCommand(ctx, "ai.scriptget", RedisAI_ScriptGet_RedisCommand, "readonly",
1390-
0, 0, 0) == REDISMODULE_ERR)
1390+
1, 1, 1) == REDISMODULE_ERR)
13911391
return REDISMODULE_ERR;
13921392

13931393
if (RedisModule_CreateCommand(ctx, "ai.scriptdel", RedisAI_ScriptDel_RedisCommand, "write", 1,
@@ -1403,7 +1403,7 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
14031403
return REDISMODULE_ERR;
14041404

14051405
if (RedisModule_CreateCommand(ctx, "ai._scriptscan", RedisAI_ScriptScan_RedisCommand,
1406-
"readonly", 1, 1, 1) == REDISMODULE_ERR)
1406+
"readonly", 0, 0, 0) == REDISMODULE_ERR)
14071407
return REDISMODULE_ERR;
14081408

14091409
if (RedisModule_CreateCommand(ctx, "ai.info", RedisAI_Info_RedisCommand, "readonly", 1, 1, 1) ==

0 commit comments

Comments
 (0)